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

Traceback (most recent call last):
File "D:\python\vnpy-2.0.6\vnpy\trader\ui\mainwindow.py", line 265, in open_widget
widget = widget_class(self.main_engine, self.event_engine)
File "D:\python\vnpy-2.0.6\vnpy\app\cta_strategy\ui\widget.py", line 37, in init
self.cta_engine.init_engine()
File "D:\python\vnpy-2.0.6\vnpy\app\cta_strategy\engine.py", line 112, in init_engine
self.load_strategy_data()
File "D:\python\vnpy-2.0.6\vnpy\app\cta_strategy\engine.py", line 779, in load_strategy_data
self.strategy_data = load_json(self.data_filename)
File "D:\python\vnpy-2.0.6\vnpy\trader\utility.py", line 91, in load_json
data = json.load(f)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json__init.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json\
init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 14 column 22 (char 259)

这个错误该怎么解决啊?谢谢

Administrator
avatar
加入于:
帖子: 4550
声望: 325

删掉C:\users\administrator.vntrader目录,然后重启,另外推荐新手用VNStudio,不要自己手动安装

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

用Python的交易员 wrote:

删掉C:\users\administrator.vntrader目录,然后重启,另外推荐新手用VNStudio,不要自己手动安装

可以说说是什么原因造成的么?之后我可以避免这样。

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

用Python的交易员 wrote:

删掉C:\users\administrator.vntrader目录,然后重启,另外推荐新手用VNStudio,不要自己手动安装

Traceback (most recent call last):
File "D:\python\vnpy-2.0.6\vnpy\app\cta_strategy\ui\widget.py", line 246, in stop_strategy
self.cta_engine.stop_strategy(self.strategy_name)
File "D:\python\vnpy-2.0.6\vnpy\app\cta_strategy\engine.py", line 693, in stop_strategy
self.sync_strategy_data(strategy)
File "D:\python\vnpy-2.0.6\vnpy\app\cta_strategy\engine.py", line 790, in sync_strategy_data
save_json(self.data_filename, self.strategy_data)
File "D:\python\vnpy-2.0.6\vnpy\trader\utility.py", line 108, in save_json
ensure_ascii=False
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json__init.py", line 179, in dump
for chunk in iterable:
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json\encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json\encoder.py", line 405, in _iterencode_dict
yield from chunks
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json\encoder.py", line 405, in _iterencode_dict
yield from chunks
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json\encoder.py", line 438, in _iterencode
o = _default(o)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.
class.name__} '
TypeError: Object of type time is not JSON serializable

Administrator
avatar
加入于:
帖子: 4550
声望: 325

应该是非正常退出,导致写入json文件到一半的时候被终止,文件被破坏了

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

用Python的交易员 wrote:

应该是非正常退出,导致写入json文件到一半的时候被终止,文件被破坏了

在使用DualThrustStrategy策略时,点击停止就出现了上述问题。
{
"123": {
"pos": 0,
"range": 0,
"long_entry": 0,
"short_entry": 0,
"exit_time":

写到这里就没写进去了,时间没写进去。

Administrator
avatar
加入于:
帖子: 4550
声望: 325

时间数据不支持持久化,请开个issue吧,我们查下

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

沪公网安备 31011502017034号

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