2

Been stuck on this for a while. All future market data permissions are enabled on our account, however when I try request historical bar data for the current futures contract for MES I get Market Data Service error message:No market data permissions for GLOBEX FUT.

    contract = Contract()
    contract.m_symbol = "MES"
    contract.m_secType = "FUT"
    contract.m_exchange = "GLOBEX"
    contract.m_currency = "USD"
    contract.m_expiry  = "20200918"
    contract.m_includeExpired = True
    contract.m_multiplier = "5"
    tws.reqMarketDataType(3)
    tws.reqMktData(897,contract,"",False)

Result (works fine):

<tickPrice tickerId=897, field=67, price=3083.5, canAutoExecute=-1>
<tickPrice tickerId=897, field=68, price=3083.25, canAutoExecute=0>
<tickPrice tickerId=897, field=72, price=3096.75, canAutoExecute=0>
<tickPrice tickerId=897, field=73, price=3027.5, canAutoExecute=0>
<tickPrice tickerId=897, field=75, price=3059.5, canAutoExecute=0>
<tickPrice tickerId=897, field=76, price=3043.0, canAutoExecute=0>

However when I try for historical data with the same contract:

    contract = Contract()
    contract.m_symbol = "MES"
    contract.m_secType = "FUT"
    contract.m_exchange = "GLOBEX"
    contract.m_currency = "USD"
    contract.m_expiry  = "20200918"
    contract.m_includeExpired = True
    contract.m_multiplier = "5"
    tws.reqMarketDataType(3)
    tws.reqHistoricalData(50, contract=contract, endDateTime=strftime("%Y%m%d %H:%M:%S"), durationStr ="30 D", barSizeSetting = "1 day", whatToShow="TRADES", formatDate=1, useRTH= "1")

I get the message from IB:

Historical Market Data Service error message:No market data permissions for GLOBEX FUT

Am I doing anything clearly wrong? I'm using IBPY2

enter image description here

Tom
  • 1,235
  • 9
  • 22

1 Answers1

3

To receive historical data from the Trader Workstation API for exchange-traded instruments (stocks, futures, options, etc), its necessary to have live data permissions for that instrument setup in your IB account.

http://interactivebrokers.github.io/tws-api/historical_data.html

It is possible to receive 10-15 minute delayed streaming data without the live data subscriptions for those instruments.

The number 3 with the function call tws.reqMarketDataType(3) indicates that delayed data will be requested by the function tws.reqMktData(897,contract,"",False). Live data, the default, would be indicated by the number 1.

http://interactivebrokers.github.io/tws-api/delayed_data.html

Josh
  • 706
  • 3
  • 8
  • When running this I get the following error: ERROR 1 354 Requested market data is not subscribed.Delayed market data is available.Error&GLOBEX/FUT/Top&GLOBEX/FUT/Top – spitz Aug 24 '20 at 21:05
  • That means you don't have the market data subscription in your account. – Josh Aug 26 '20 at 19:47