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

What does the documentation mean by "Cash Product"



  • In the documentation for backtrader interactive brokers live tick data feeds, it mentions that you can only get tick data for Cash Products.

    https://www.backtrader.com/docu/live/ib/ib.html?highlight=getdata#data-options

    What is a Cash Product?



  • Some googling revealed that Cash Product means a security that is traded directly as opposed to a futures market.
    https://www.investopedia.com/terms/c/cashmarket.asp

    So, apparently you can get tick data for the sp500 but not futures on the sp500.

    My question is now, why is the API showing me tick data for the sp500 futures contract.
    ES-FUT-GLOBEX-USD-201812

    <tickSize tickerId=16777217, field=3, size=15>
    <tickString tickerId=16777217, tickType=48, value=2645.25;9;1540859059302;27413;2640.47695436;true>
    1813,2018-10-30T00:24:19.302002,2645.25,2645.25,2645.25,2645.25,9.00
    miaooo
    <tickSize tickerId=16777217, field=8, size=27433>
    <tickString tickerId=16777217, tickType=45, value=1540859060>
    <tickPrice tickerId=16777217, field=4, price=2645.25, canAutoExecute=0>
    <tickSize tickerId=16777217, field=5, size=9>
    <tickSize tickerId=16777217, field=5, size=9>
    <tickPrice tickerId=16777217, field=1, price=2645.25, canAutoExecute=1>
    <tickSize tickerId=16777217, field=0, size=14>
    <tickPrice tickerId=16777217, field=2, price=2645.5, canAutoExecute=1>
    <tickSize tickerId=16777217, field=3, size=33>
    

    when I use this data feed to get data

        data = ibstore.getdata(dataname='ES-FUT-GLOBEX-USD-201812', timeframe=bt.TimeFrame.Seconds, compression=1, rtbar=True)
    

    I'm getting data each second, the tick data is being displayed in the debug line but when I specify ticks as the timeframe, I'm immediately disconnected from the API

        data = ibstore.getdata(dataname='ES-FUT-GLOBEX-USD-201812', timeframe=bt.TimeFrame.Ticks, compression=1, rtbar=True)
    
    <contractDetailsEnd reqId=16777216>
    ***** DATA NOTIF: DELAYED
    <marketDataType reqId=16777217, marketDataType=1>
    <tickPrice tickerId=16777217, field=1, price=2648.0, canAutoExecute=1>
    <tickSize tickerId=16777217, field=0, size=12>
    <tickPrice tickerId=16777217, field=2, price=2648.25, canAutoExecute=1>
    <tickSize tickerId=16777217, field=3, size=41>
    <tickPrice tickerId=16777217, field=4, price=2648.0, canAutoExecute=0>
    <tickSize tickerId=16777217, field=5, size=22>
    <tickSize tickerId=16777217, field=0, size=12>
    <tickSize tickerId=16777217, field=3, size=41>
    <tickSize tickerId=16777217, field=5, size=22>
    <tickSize tickerId=16777217, field=8, size=29281>
    <tickPrice tickerId=16777217, field=6, price=2648.25, canAutoExecute=0>
    <tickPrice tickerId=16777217, field=7, price=2636.25, canAutoExecute=0>
    <tickPrice tickerId=16777217, field=9, price=2643.5, canAutoExecute=0>
    <tickPrice tickerId=16777217, field=14, price=2639.0, canAutoExecute=0>
    <tickString tickerId=16777217, tickType=45, value=1540859254>
    <tickGeneric tickerId=16777217, tickType=49, value=0.0>
    <tickString tickerId=16777217, tickType=48, value=2648.00;1;1540859255824;29240;2640.86523598;true>
    ***** DATA NOTIF: DISCONNECTED
    []
    

  • administrators

    @sneilan said in What does the documentation mean by "Cash Product":

    What is a Cash Product?

    @sneilan said in What does the documentation mean by "Cash Product":

    Some googling revealed that Cash Product means a security that is traded directly as opposed to a futures market.
    https://www.investopedia.com/terms/c/cashmarket.asp

    No. A Cash product is what Interactive Brokers defines to be a CASH product and not what Investopedia says, which applies to Forex pairs. This is not defined by backtrader.

    @sneilan said in What does the documentation mean by "Cash Product":

    https://www.backtrader.com/docu/live/ib/ib.html?highlight=getdata#data-options

    This simply details the options which Interactive Brokers offers to get prices, which cannot be influenced by backtrader itself.

    @sneilan said in What does the documentation mean by "Cash Product":

    So, apparently you can get tick data for the sp500 but not futures on the sp500.

    This is wrong. You are confusing an option from the API (tickPrice) about how to get prices for a given product, with what you can actually get delivered.

    You should read the Interactive Brokers documentation to understand the options.

    Actually, you never get Tick prices from Interactive Brokers (unless something has changed lately), because what you get as tick prices comes in every 250 ms and is a snapshot of the price changes occurred over that period.

    @sneilan said in What does the documentation mean by "Cash Product":

    I'm getting data each second, the tick data is being displayed in the debug line but when I specify ticks as the timeframe, I'm immediately disconnected from the API

    You should again read what rtBar (RealTimeBar) means in the context of the Interactive Brokers API. The latest definition is that you will get a 5 seconds consolidated bar with accurate pricing and volume (you may of course understand that other options like receiving the 250 ms snapshots, may actually be inaccurate - and they sometimes are-)