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/

    Paper trading with Interactive Broker, how to request delayed data?

    General Discussion
    4
    8
    3520
    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.
    • A
      albertzgd last edited by albertzgd

      Hi All, I've been trying to do paper trading with Bactrader and Interactive Broker. Currently, I only have a paper trading account with no market data subscription so any stock data is delayed for 15 minutes. When I try to request this delayed market data, I get the following error message:

      ***** STORE NOTIF: <error id=-1, errorCode=2104, errorMsg=Market data farm connection is OK:usfuture>
      ***** STORE NOTIF: <error id=-1, errorCode=2104, errorMsg=Market data farm connection is OK:cashfarm>
      ***** STORE NOTIF: <error id=-1, errorCode=2104, errorMsg=Market data farm connection is OK:usfarm.us>
      ***** STORE NOTIF: <error id=-1, errorCode=2104, errorMsg=Market data farm connection is OK:usfarm>
      ***** STORE NOTIF: <error id=-1, errorCode=2106, errorMsg=HMDS data farm connection is OK:cashhmds>
      ***** STORE NOTIF: <error id=-1, errorCode=2106, errorMsg=HMDS data farm connection is OK:ushmds>
      ***** STORE NOTIF: <error id=16777217, errorCode=10168, errorMsg=Requested market data is not subscribed. Delayed market data is not enabled>

      I have been searching online for quite some time but unfortunately, the documentation for both ibpy and ibapi are very lacking and I can't solve this problem. Does anyone know how to solve this issue?

      Many thanks

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        Delayed data is NOT served by TWS via the API

        1 Reply Last reply Reply Quote 0
        • A
          albertzgd last edited by albertzgd

          @backtrader Thank you very much for your reply.

          However, as I read from https://interactivebrokers.github.io/tws-api/delayed_data.html

          It seems that one can get delayed streaming data from TWS vis the API. After the connection object gets connected with TWS, it does have a method named reqMarketDataType, which after I called in the ibstore class, did get rid of the error message :<error id=16777217, errorCode=10168, errorMsg=Requested market data is not subscribed. Delayed market data is not enabled>, but still didn't provide me any streaming data.

          Is that IB API documentation outdated? Or I didn't understand it correctly?

          Thank you again for your kind help.

          A 1 Reply Last reply Reply Quote 0
          • A
            ab_trader @albertzgd last edited by ab_trader

            @albertzgd based on the error message you don't have subscription to the data.

            Other thought - backtrader backfills by default. It can be considered as historical data download and requires subscription.

            • If my answer helped, hit reputation up arrow at lower right corner of the post.
            • Python Debugging With Pdb
            • New to python and bt - check this out
            A 1 Reply Last reply Reply Quote 0
            • A
              albertzgd @ab_trader last edited by

              @ab_trader Thanks very much for your reply.

              I know I don't have subscription to the data, but interactive broker still provides 10-15 minutes delayed streaming data for those who don't have subscriptions. I just want to work with this free delayed streaming data before I pay to get market data subscription.

              A 1 Reply Last reply Reply Quote 0
              • A
                ab_trader @albertzgd last edited by

                @albertzgd just updated my post - error can be due to backfilling.

                • If my answer helped, hit reputation up arrow at lower right corner of the post.
                • Python Debugging With Pdb
                • New to python and bt - check this out
                A 1 Reply Last reply Reply Quote 0
                • A
                  albertzgd @ab_trader last edited by

                  @ab_trader I tried backfill_start=False, and it didn't solve the problem.

                  I did manage to get delayed streaming data with only Ibpy, but it came with a very weird format and I don't know how to hook it with backtrader.

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    alexgiul @albertzgd last edited by

                    @albertzgd so you was able to use your paper account or the "demo" account to retrieve the delayed stream?
                    The prices retrieved with "demo" account is clutter (I read it somewhere)

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