vnpy / vnpy_ib

VeighNa框架的InteractiveBrokers交易接口
https://www.vnpy.com
MIT License
34 stars 31 forks source link

HistoryRequest 是None #13

Closed dalitang closed 1 year ago

dalitang commented 1 year ago

Exception in thread Thread-9 (run): Traceback (most recent call last): File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/ibapi/client.py", line 263, in run self.decoder.interpret(fields) File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/ibapi/decoder.py", line 1296, in interpret handleInfo.processMeth(self, iter(fields)) File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/ibapi/decoder.py", line 519, in processHistoricalDataMsg self.wrapper.historicalData(reqId, bar) File "/opt/homebrew/Caskroom/miniforge/base/envs/py310/lib/python3.10/site-packages/vnpy_ib/ib_gateway.py", line 619, in historicalData symbol=self.history_req.symbol, AttributeError: 'NoneType' object has no attribute 'symbol'

这个应该是api返回了None或者是还没有等到返回值?

dalitang commented 1 year ago

update: https://interactivebrokers.github.io/tws-api/historical_bars.html endDateTime, The request's end date and time (the empty string indicates current present moment).

还是时间格式的问题,如果hardcode, 就可以正常下载 self.client.reqHistoricalData( self.reqid, ib_contract, '',# end_str, duration, bar_size, bar_type, 0, 1, False, [] )

noranhe commented 1 year ago

可参考 https://github.com/vnpy/vnpy_ib/issues/12 最新回复