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

Interactive Broker on daily data and paper account



  • I'm trying to connect to IB with paper account to receive daily bars

    cerebro = bt.Cerebro()
    ibstore = bt.stores.IBStore(host='127.0.0.1', port=8002, clientId=3,notifyall=True)
    cerebro.broker = ibstore.getbroker()
    ib_dataname = 'TWTR-STK-SMART-USD'
    data = ibstore.getdata(dataname=ib_dataname,name='TWTR',timeframe=bt.TimeFrame.Days,compression=1,rtbar=False)
    cerebro.resampledata(data, timeframe=bt.TimeFrame.Days, compression=1)
    cerebro.adddata(data)
    cerebro.addstrategy(strategy)
    cerebro.run()
    

    After strategy init I get the message "Requested market data is not subscribed"
    Since I did not configure ib store to receive rt data,can anyone explain the error mesage ?
    Whan receiving daily bars, when exactly during the trading day is the bar accepted? end of day?
    Thank you.



  • @Trade-Prophet just wild guess - maybe you need subscription for real time data thru IB. By default all prices are delayed.



  • @Trade-Prophet said in Interactive Broker on daily data and paper account:

    Since I did not configure ib store to receive rt data,can anyone explain the error mesage ?

    Can you elaborate on what do you actually mean with it?

    Unless my understanding of the IBStore is completely wrong you are requesting real-time data.

    Additionally and as pointed by @ab_trader

    @ab_trader said in Interactive Broker on daily data and paper account:

    @Trade-Prophet just wild guess - maybe you need subscription for real time data thru IB

    You need a subscription even if request historical data. Getting delayed data quotes in TWS is not the same as being able to download them in your own client through the API.



  • Problem Solved!

    Issues I had in the process:

    1. Paper account may receive RT bars(like 1 or 5 minutes bars), to enable that you need to enable "Share real-time market data subscriptions with paper trading account" option in your real live account, ask IB support for help to find it
    2. You MUST run the trading strategy on the same computer where the real live account runs, it's not possible to have the live account run TWS on one computer and the paper TWS run on another

    once you take care of the above, the Backtrader running IB trading should start to trade with the paper account