I'm using Python and ib_insync to use the Interactive brokers API, I'm trying to get market data as Bid, Ask,AskSize etc of a future Options contract, but when convert this contract on a ticker I got "No security definition has been found for the request", even when I assign this attribute before.
# using Future from ib_insync has the same problem
# contract = Future('ES',"20190315",'GLOBEX')
contract = Contract()
contract.symbol = "ES"
contract.secType = "FOP"
contract.exchange = "GLOBEX"
contract.currency = "USD"
contract.lastTradeDateOrContractMonth = "20190315"
contract.strike = 2900
contract.right = "C"
contract.multiplier = "50"
result =[]
result.append(contract)
ib.reqMarketDataType(3)
ib.qualifyContracts(*result)
ticker = ib.reqMktData(contract,"",False,False)
ib.sleep(3)
ticker
Output:
Error 200, reqId 26: No security definition has been found for the request, contract: Contract(secType='FOP', symbol='ES', lastTradeDateOrContractMonth='20190315', strike=2900, right='C', multiplier='50', exchange='GLOBEX', currency='USD')
Unknown contract: Contract(secType='FOP', symbol='ES', lastTradeDateOrContractMonth='20190315', strike=2900, right='C', multiplier='50', exchange='GLOBEX', currency='USD')