For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Backtrader IB-test



  • Using the IB-test code, this error appears:
    usage: backtrader-ib-test.py [-h] [--exactbars EXACTBARS] [--plot]
    [--stopafter STOPAFTER] [--usestore]
    [--notifyall] [--debug] [--host HOST]
    [--qcheck QCHECK] [--port PORT]
    [--clientId CLIENTID] [--no-timeoffset]
    [--reconnect RECONNECT] [--timeout TIMEOUT]
    --data0 DATA0 [--data1 DATA1]
    [--timezone TIMEZONE] [--what WHAT]
    [--no-backfill_start] [--latethrough]
    [--no-backfill] [--rtbar] [--historical]
    [--fromdate FROMDATE] [--smaperiod SMAPERIOD]
    [--replay | --resample]
    [--timeframe {,Ticks,MicroSeconds,Seconds,Minutes,Days,Weeks,Months,Years,NoTimeFrame}]
    [--compression COMPRESSION]
    [--timeframe1 {,Ticks,MicroSeconds,Seconds,Minutes,Days,Weeks,Months,Years,NoTimeFrame}]
    [--compression1 COMPRESSION1] [--no-takelate]
    [--no-bar2edge] [--no-adjbartime]
    [--no-rightedge] [--broker] [--trade]
    [--donotsell]
    [--exectype {Market,Close,Limit,Stop,StopLimit,StopTrail,StopTrailLimit,Historical}]
    [--stake STAKE] [--valid VALID]
    [--stoptrail | --traillimit | --oca | --bracket]
    [--trailamount TRAILAMOUNT | --trailpercent TRAILPERCENT]
    [--limitoffset LIMITOFFSET] [--cancel CANCEL]
    backtrader-ib-test.py: error: the following arguments are required: --data0

    I do not know how to solve it


  • administrators

    @estebandaniel said in Backtrader IB-test:

    the following arguments are required: --data0

    It's not an error. You have to provide a ticker and to make sense of it, some other options. There is a blog post, for example, which shown: Blog - Live Data/Live Trading

    ./ibtest.py --port 7497 --data0 TWTR --resample --timeframe Seconds --compression 5
    

    ibtest.py is not something you use to trade/backtest. It is script which is meant to test the different functionalities with the `IBStore.

    There is an article in Medium which describes how to set up your own script (although the only thing which differs from backtesting with the standard setup is the setup of the store to get the data feed and replace the backtesting broker with the live broker) Medium - Interactive Brokers in Python with backtrader



  • @backtrader Thanks! Now this message appears. I have the TWS API well configured but I do not know what the problem is.

    Datetime, Open, High, Low, Close, Volume, OpenInterest, SMA
    ***** STORE NOTIF: <error id=None, errorCode=None, errorMsg=chr() arg not in range(0x110000)>
    ***** STORE NOTIF: Ambiguous contract: none/multiple answers received
    ***** DATA NOTIF: DISCONNECTED


  • administrators

    The first thing would be that you show what you have executed ...