VeighNa量化社区
你的开源社区量化交易平台
Member
加入于:
帖子: 81
声望: 0

打开CTA 策略的时候出现下面 异常报错。
没有办法打开CTA 策略模块。请问应该如何处理呀?

Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\trader\ui\mainwindow.py", line 281, 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 110, in init_engine
self.load_strategy_data()
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\engine.py", line 800, in load_strategy_data
self.strategy_data = load_json(self.data_filename)
File "c:\vnstudio\lib\site-packages\vnpy\trader\utility.py", line 99, in load_json
data = json.load(f)
File "c:\vnstudio\lib\json__init.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "c:\vnstudio\lib\json\
init__.py", line 348, in loads
return _default_decoder.decode(s)
File "c:\vnstudio\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "c:\vnstudio\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 29 column 38 (char 633)

Member
加入于:
帖子: 81
声望: 0

charlesttt wrote:

打开CTA 策略的时候出现下面 异常报错。
没有办法打开CTA 策略模块。请问应该如何处理呀?

Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\trader\ui\mainwindow.py", line 281, 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 110, in init_engine
self.load_strategy_data()
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\engine.py", line 800, in load_strategy_data
self.strategy_data = load_json(self.data_filename)
File "c:\vnstudio\lib\site-packages\vnpy\trader\utility.py", line 99, in load_json
data = json.load(f)
File "c:\vnstudio\lib\json__init.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "c:\vnstudio\lib\json\
init__.py", line 348, in loads
return _default_decoder.decode(s)
File "c:\vnstudio\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "c:\vnstudio\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 29 column 38 (char 633)

我找到原因了。是不是不需要自己存储strategy data?我自己又写了代码在策略结束时存里面的变量,这就会和VNPY 自己的储存冲突了?

Member
avatar
加入于:
帖子: 4882
声望: 293

先删除C:\users\administrator.vntrader里对应的json文件,再重启。如果还报同样的错,建议检查一下策略参数的类型。检查一下策略里是否有把str\bool\int\float以外的变量名,写到了parameters列表中,json文件保存不了这四种基础数据以外的类型,就会出错。

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

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】