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?



  • 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


  • administrators

    Delayed data is NOT served by TWS via the API



  • @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.



  • @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.



  • @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.



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



  • @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.



  • @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)