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

16:13:26 初始化CTA回测引擎
16:13:26 策略文件strategies.backtesting_demo加载失败,触发异常:
Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\peewee.py", line 3144, in execute_sql
cursor.execute(sql, params or ())
sqlite3.OperationalError: no such column: t1.turnover

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy_ctabacktester\engine.py", line 109, in load_strategy_class_from_module
module = importlib.import_module(module_name)
File "c:\vnstudio\lib\importlib__init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\DELL\strategies\backtesting_demo.py", line 28, in <module>
engine.load_data()
File "c:\vnstudio\lib\site-packages\vnpy_ctastrategy\backtesting.py", line 186, in load_data
end
File "c:\vnstudio\lib\site-packages\vnpy_ctastrategy\backtesting.py", line 1053, in load_bar_data
symbol, exchange, interval, start, end
File "c:\vnstudio\lib\site-packages\vnpy_sqlite\sqlite_database.py", line 232, in load_bar_data
for db_bar in s:
File "c:\vnstudio\lib\site-packages\peewee.py", line 6874, in
iter
self.execute()
File "c:\vnstudio\lib\site-packages\peewee.py", line 1907, in inner
return method(self, database, *args, **kwargs)
File "c:\vnstudio\lib\site-packages\peewee.py", line 1978, in execute
return self._execute(database)
File "c:\vnstudio\lib\site-packages\peewee.py", line 2150, in _execute
cursor = database.execute(self)
File "c:\vnstudio\lib\site-packages\peewee.py", line 3157, in execute
return self.execute_sql(sql, params, commit=commit)
File "c:\vnstudio\lib\site-packages\peewee.py", line 3151, in execute_sql
self.commit()
File "c:\vnstudio\lib\site-packages\peewee.py", line 2917, in
exit__
reraise(new_type, new_type(exc_value, *exc_args), traceback)
File "c:\vnstudio\lib\site-packages\peewee.py", line 190, in reraise
raise value.with_traceback(tb)
File "c:\vnstudio\lib\site-packages\peewee.py", line 3144, in execute_sql
cursor.execute(sql, params or ())
peewee.OperationalError: no such column: t1.turnover

16:13:26 策略文件strategies.CSVloadTick加载失败,触发异常:
Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy_ctabacktester\engine.py", line 109, in load_strategy_class_from_module
module = importlib.import_module(module_name)
File "c:\vnstudio\lib\importlib__init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 860, in get_code
File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\DELL\strategies\CSVloadTick.py", line 69
if
name == "main__":
^
IndentationError: unindent does not match any outer indentation level

16:13:26 策略文件strategies.recordtick加载失败,触发异常:
Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy_ctabacktester\engine.py", line 109, in load_strategy_class_from_module
module = importlib.import_module(module_name)
File "c:\vnstudio\lib\importlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\DELL\strategies\recordtick.py", line 9, in <module>
from vnpy.trader.database import init
ImportError: cannot import name 'init' from 'vnpy.trader.database' (c:\vnstudio\lib\site-packages\vnpy\trader\database.py)

Member
avatar
加入于:
帖子: 4666
声望: 285

turnover的报错请参考2.5.0发布公告的数据库升级迁移部分https://www.vnpy.com/forum/topic/7454-vn-pyfa-bu-v2-5-0-webying-yong-hou-duan-fu-wu
如果想使用2.6.0,请先查看2.6.0的发布公告https://www.vnpy.com/forum/topic/7705-vn-pyfa-bu-v2-6-0-gao-xing-neng-jin-rong-shu-ju-ku
数据库升级了'vnpy.trader.database下没有init了

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

非常感谢!
2.6.0版本sqlite3数据库dbbardata表增加turnover字段,dbtickdata表增加turnover和datetime字段。
使用2.5版本sqlite3数据库,需要新增以上字段。方法:
1.使用SQLiteStudio工具打开dbbase数据库;
2.增加turnover字段(注意不选非空!),提交更新。
3.Update dbbardata SET turnover = 0
4.查看结果,修改turnover字段属性为非空,
5.dbtickdata表增加turnover和datetime字段,操作同dbbardata表

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

沪公网安备 31011502017034号

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