Navigation

    Backtrader Community

    • Register
    • 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 data feed not sending data

    General Code/Help
    1
    4
    153
    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.
    • vuduclong0309
      vuduclong0309 last edited by

      Hi all,

      Currently I'm having a problem getting data stream from IBKR. The program appears to be stuck after verified all connections are OK.

      Env info:
      Window 11
      Python 3.9.13

      I have subscribed into real time market data from IBKR, and verified it by successfully retrieve real data with vanilla ibapi wrapper.

      f70e92e2-27ed-4f59-a325-b3cd8b98b2c0-image.png

      Here is my current TWS API setting.
      7dcc2e36-54eb-4546-b054-4a19636441e7-image.png

      I have tried various troubleshooting methods but without any solution, including:

      • Test running the sample file at https://github.com/mementum/backtrader/blob/master/samples/ibtest/ibtest.py and printing debug message in every step. The pre-next() and next() function appear to be not called
      • Waited for 30 minutes for a running instance.
        03a6c4ad-444d-46c9-9ddc-d8bcc600656f-image.png
      • Follow troubleshoot steps in a few historical threads with the same issue: https://community.backtrader.com/topic/2091/starting-with-interactive-brokers-ib-no-data-feed (OP still can query data for forex but I cannot query for anything, both stock and forex)
        & https://community.backtrader.com/topic/1313/ib-backtesting-stuck-at-status-delayed (Turned historical flag on and off)
      • Ran script at different times (pre-market, market & after-hour)
      • Ran script in both real account (read-only) and paper trading account (port 7496 & 7497)
      • Restarted the computer and rerun
      • Tried the same above steps with an alternative computer running on Ubuntu 13.04.
      • Investigated TWS folder for API log, but found no log file.

      Currently I'm running out of troubleshooting idea at the moment, so any advise would be much appreciated.

      Thanks in advance!

      vuduclong0309 1 Reply Last reply Reply Quote 0
      • vuduclong0309
        vuduclong0309 @vuduclong0309 last edited by

        @vuduclong0309

        Build 10.18.1e, Sep 20, 2022 4:11:21 PM 
        Jolt Build 1.18.9, Jul 5, 2022 05:27:19 PM 
        Nia Build 2.24.2, Jan 17, 2022 05:48:10 PM 
        ModelNav Build 1.13.2, Jan 24, 2022 04:59:21 PM 
        Riskfeed Build 2.45.3, Jul 25, 2022 06:42:42 PM
        
        backtrader           1.9.76.123
        ibapi                9.81.1.post1
        IbPy2                0.8.0
        pip                  22.2.2
        ta                   0.10.2
        yfinance             0.1.74
        
        vuduclong0309 1 Reply Last reply Reply Quote 0
        • vuduclong0309
          vuduclong0309 @vuduclong0309 last edited by

          @vuduclong0309 Update: I was able to get the API Log for TWS. I noticed that there appear to be a sending error for every data send (marked with red)

          0e8b36cc-de3f-4fcc-b5ef-8225963e3473-image.png

          vuduclong0309 1 Reply Last reply Reply Quote 0
          • vuduclong0309
            vuduclong0309 @vuduclong0309 last edited by

            @vuduclong0309 Update: Found root cause and temporary workaround:

            Root cause:
            TWS 10.17 Changed format for timezone, affecting historical data request. Ref: https://forum.amibroker.com/t/please-look-at-timeinforce-part-of-place-order-code/31980

            Solution:
            Change to use TWS at STABLE version (10.12) instead of LATEST version (10.17). https://agenatrader.com/wiki/tiki-index.php?page=How+to+change+TWS+version+from+Latest+to+Stable
            Reran the code, appear to be normal

            bf414562-cb7e-44cb-89b1-5feeef42019a-image.png

            Nonetheless, this temporary solution might be invalidated when TWS decide to keep the change and make 10.17 to be the STABLE version

            Hope this can help anyone who have the same problem, I'm still looking for a permanent fix on this issue.

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