vn.py官网
开源量化社区
Member
avatar
加入于:
帖子: 15
声望: 1

UI界面刷新数据时就报下面的错:
Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\data_manager\ui\widget.py", line 191, in refresh_tree
item.setText(5, d["start"].strftime("%Y-%m-%d %H:%M:%S"))
AttributeError: 'str' object has no attribute 'strftime'

回测时数据的datetime时间后面多了个 +08:06 :
BarData(gateway_name='DB', symbol='ag2102', exchange=<Exchange.SHFE: 'SHFE'>, datetime='2020-07-23 00:18:00+08:06', interval=<Interval.MINUTE: '1m'>, volume=12.0, open_interest=13804.0, open_price=5347.0, high_price=5358.0, low_price=5347.0, close_price=5358.0)
2020-07-23 00:20:28.770425 触发异常,回测终止
2020-07-23 00:20:28.786070 Traceback (most recent call last):
File "C:\vnstudio\Lib\site-packages\vnpy\app\cta_strategy\backtesting.py", line 288, in run_backtesting
self.callback(data)
File "C:/vnstudio/Lib/site-packages/vnpy/app/cta_strategy/strategies/haigui_2.py", line 80, in on_bar
self.bg.update_bar(bar)
File "C:\vnstudio\Lib\site-packages\vnpy\trader\utility.py", line 254, in update_bar
dt = bar.datetime.replace(minute=0, second=0, microsecond=0)
TypeError: replace() takes no keyword arguments

请问大神们这个要怎么弄,求指点,等着用,不胜感激···

Member
avatar
加入于:
帖子: 3027
声望: 174

datetime是2.1.3的更新,详情请看这里。如果策略需要,可以自己做一下相应的调整

Member
avatar
加入于:
帖子: 15
声望: 1

xiaohe wrote:

datetime是2.1.3的更新,详情请看这里。如果策略需要,可以自己做一下相应的调整
好的,谢谢

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

沪公网安备 31011502017034号