Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    IBKR not getting live data

    General Code/Help
    2
    4
    107
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      Raylan last edited by

      Hi,

      I have been unable to get LIVE data from IBKR. Am trading ES futures.

      I can get historical data. That all works fine, but once i try to get LIVE data the feed is stuck on DELAYED, and I'm not getting any data at all.

      I have looked in earlier topics and I did see the issue come up, but I didn't see a solution that worked for me. Any ideas would be greatly appreciated.

      The main part of my code

          cerebro = bt.Cerebro(stdstats=True, tradehistory=True)
          store = bt.stores.IBStore(host="127.0.0.1", port=7497, clientId=35)
          cerebro.broker = store.getbroker()
          stockkwargs = dict(
              timeframe = bt.TimeFrame.Ticks,
              useRTH = False,
              rtBar = False,
              #backfill_start=False, 
              #backfill=False
              #historical = True,  # only historical download
              #fromdate = fromdate,  # get data from..
              #todate = todate,
              )
          data = store.getdata(dataname='ES-FUT-GLOBEX-USD-202212-50', **stockkwargs)
          cerebro.resampledata(data, timeframe=bt.TimeFrame.Seconds, compression=10)
          cerebro.addwriter(bt.WriterFile, csv=True, out='output.csv'.format('ES'))
          cerebro.addstrategy(Levels)
          cerebro.addobserver(bt.obs.Trades) 
          cerebro.addanalyzer(trade_list, _name="trade_list")
          result = cerebro.run()
      
      1 Reply Last reply Reply Quote 0
      • R
        Raylan last edited by

        Not sure how to edit. But I forgot to add that the above I'm running on my paper account. I do however have a funded account and market data subscriptions, so I do get live futures data on the paper account in TWS.

        1 Reply Last reply Reply Quote 0
        • L
          Lennie last edited by

          I just made a through post for this

          related posts [106455, 10384, 12483, 6138, 6522106455, 10384, 12483, 6138, 6522]

          It is possible the answer is an update to IB API that doesn't accept GMT timezone for backfilling. (after version 10.16)

          currently the only fix I could find is to remove backfilling.

          setting the data args backfill_start=False, backfill=False fixes the hanging problem but creates other problems if backfilling data is required for indicators

          L 1 Reply Last reply Reply Quote 0
          • L
            Lennie @Lennie last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors