erdewit / ib_insync

Python sync/async framework for Interactive Brokers API
BSD 2-Clause "Simplified" License
2.84k stars 770 forks source link

ticker.marketPrice() doesn't work with delayed quotes #111

Closed steel3d closed 5 years ago

steel3d commented 5 years ago

Repro:

cont = Index("vix") ib.qualifyContracts(cont) ib.reqMarketDataType(3) #MarketDataTypeEnum.DELAYED) ib.reqMktData(cont, '', False, False) ticker = ib.ticker(cont) ib.sleep(1) print(ticker) print(ticker.marketPrice())

marketPrice() failed with exception (I think bid/ask was not available). Had to use ticker.last instead. Sorry, I can't repro since I subscribed to the correct market data, so I can't give the exact call stack. One I subscribed to market data, marketPrice() works fine even with reqMarketDataType(3).

erdewit commented 5 years ago

I can close this then. Note that you can do

ticker = ib.reqMktData(cont, '', False, False)