vn.py量化社区
By Traders, For Traders.
Member
avatar
加入于:
帖子: 78
声望: 0

Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\vnstudio\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\vnstudio\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "C:\vnstudio\lib\site-packages\vnpy-2.1.2-py3.7.egg\vnpy\event\engine.py", line 60, in _run
self._process(event)
File "C:\vnstudio\lib\site-packages\vnpy-2.1.2-py3.7.egg\vnpy\event\engine.py", line 73, in _process
[handler(event) for handler in self._handlers[event.type]]
File "C:\vnstudio\lib\site-packages\vnpy-2.1.2-py3.7.egg\vnpy\event\engine.py", line 73, in <listcomp>
[handler(event) for handler in self._handlers[event.type]]
File "C:\vnstudio\lib\site-packages\vnpy-2.1.2-py3.7.egg\vnpy\app\option_master\engine.py", line 173, in process_tick_event
portfolio.update_tick(tick)
File "C:\vnstudio\lib\site-packages\vnpy-2.1.2-py3.7.egg\vnpy\app\option_master\base.py", line 606, in update_tick
chain.update_tick(tick)
File "C:\vnstudio\lib\site-packages\vnpy-2.1.2-py3.7.egg\vnpy\app\option_master\base.py", line 436, in update_tick
option.update_tick(tick)
File "C:\vnstudio\lib\site-packages\vnpy-2.1.2-py3.7.egg\vnpy\app\option_master\base.py", line 279, in update_tick
self.calculate_option_impv()
File "C:\vnstudio\lib\site-packages\vnpy-2.1.2-py3.7.egg\vnpy\app\option_master\base.py", line 176, in calculate_option_impv
underlying_price = self.underlying.mid_price
AttributeError: 'NoneType' object has no attribute 'mid_price'

这个问题偶而会出现, 尤其是在交易的开市时段 启动vnpy时,有一定的概率会出现, 不知道是不是标的物合约还未设置,就有期权合约的Tick进来,然后就开始计算隐波了,
可不可以像calculate_cash_greeks那样, 在calculate_option_impv函数开头,加一个:

if not self.underlying:
return

我来试试看,

Administrator
avatar
加入于:
帖子: 3913
声望: 208

好的,确定有问题的话欢迎开个issue哈

Member
avatar
加入于:
帖子: 78
声望: 0

好的,我刚提了三个issue, 有一个我也还没有定位到
https://github.com/vnpy/vnpy/issues/2499
https://github.com/vnpy/vnpy/issues/2500
https://github.com/vnpy/vnpy/issues/2501

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3