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

cta课程第七课按课程写出策略代码后,在回测界面运行时出现如下提示:
17:30:12 触发异常,回测终止
17:30:12 Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\backtesting.py", line 291, in run_backtesting
self.callback(data)
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\strategies\Demo_5MINStrategy.py", line 71, in on_bar
self.bg.update_bar(bar)
File "c:\vnstudio\lib\site-packages\vnpy\trader\utility.py", line 264, in update_bar
self.update_bar_minute_window(bar)
File "c:\vnstudio\lib\site-packages\vnpy\trader\utility.py", line 300, in update_bar_minute_window
self.on_window_bar(self.window_bar)
TypeError: on_5min_bar() takes 1 positional argument but 2 were given
,我已经检查了代码拼写,也没发现哪里跟课程里面代码不符,
麻烦各位大神给指点下

Administrator
avatar
加入于:
帖子: 4749
声望: 278

self.on_5min_bar的函数定义,漏了bar这个参数吧

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

沪公网安备 31011502017034号