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

小白求助——功能-CTA回测触发异常,错误如下,跪求各路大神指点~~~~~

Traceback (most recent call last):
File "C:\vnstudio\lib\site-packages\vnpy\trader\ui\mainwindow.py", line 278, in open_widget
widget = widget_class(self.main_engine, self.event_engine)
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_backtester\ui\widget.py", line 48, in init
self.init_strategy_settings()
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_backtester\ui\widget.py", line 55, in init_strategy_settings
setting = self.backtester_engine.get_default_setting(class_name)
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_backtester\engine.py", line 239, in get_default_setting
return strategy_class.get_class_parameters()
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\template.py", line 60, in get_class_parameters
class_parameters[name] = getattr(cls, name)
AttributeError: type object 'DemoStrategy' has no attribute 'fast_window'
——————————————————————————————————————————————————
点击CTA策略,错误如下
Traceback (most recent call last):
File "C:\vnstudio\lib\site-packages\vnpy\trader\ui\mainwindow.py", line 278, in open_widget
widget = widget_class(self.main_engine, self.event_engine)
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\ui\widget.py", line 37, in init
self.cta_engine.init_engine()
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\engine.py", line 107, in init_engine
self.load_strategy_class()
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\engine.py", line 756, in load_strategy_class
self.load_strategy_class_from_folder(path2, "strategies")
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\engine.py", line 771, in load_strategy_class_from_folder
self.load_strategy_class_from_module(strategy_module_name)
UnboundLocalError: local variable 'strategy_module_name' referenced before assignment

弄了两天了,求帮忙~~~~

Administrator
avatar
加入于:
帖子: 3810
声望: 199

升级到2.0.9

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

用Python的交易员 wrote:

升级到2.0.9
我用的就是2.0.9的呢

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

同样的问题 , 你解决了么?

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

亦佛亦魔 wrote:

用Python的交易员 wrote:

升级到2.0.9
我用的就是2.0.9的呢
C:\Users\Administrator.vntrader
里面数据让我清理了, 就好了.

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

wrote:

亦佛亦魔 wrote:

用Python的交易员 wrote:

升级到2.0.9
我用的就是2.0.9的呢
C:\Users\Administrator.vntrader
里面数据让我清理了, 就好了.
我把VN station卸载,把.vnstation,.vntrader文件夹删除,重新安装2.0.9都还是存在同样问题,而且关闭软件重新打开,又有其他错误,如下
Traceback (most recent call last):
File "C:\vnstudio\lib\site-packages\vnpy\trader\ui\mainwindow.py", line 278, in open_widget
widget = widget_class(self.main_engine, self.event_engine)
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\ui\widget.py", line 37, in init
self.cta_engine.init_engine()
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\engine.py", line 106, in init_engine
self.init_rqdata()
File "C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\engine.py", line 128, in init_rqdata
result = rqdata_client.init()
File "C:\vnstudio\lib\site-packages\vnpy\trader\rqdata.py", line 56, in init
use_pool=True,
File "C:\vnstudio\lib\site-packages\rqdatac\client.py", line 167, in init
remaining_days = quota["remaining_days"]
TypeError: 'NoneType' object is not subscriptable
小白入门太难了,按视频一步一步做都还出错

Administrator
avatar
加入于:
帖子: 3810
声望: 199

先排查这个错误:AttributeError: type object 'DemoStrategy' has no attribute 'fast_window'

你的策略类里,少了fast_window这个数据

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