Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在CTA 回测模块中下载数据,当输入开始时间早于rqalpha 数据点时,vnpy 抛出错误 #1723

Closed
wilsonkrum opened this issue May 20, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@wilsonkrum
Copy link

commented May 20, 2019

环境

  • 操作系统: 如Windows 10
  • Anaconda版本: 如Anaconda 18.12 Python 3.7 64位
  • vn.py版本: 2.0.2

Issue类型

三选一:Bug

预期程序行为

在CTA 回测模块中下载数据,当输入开始时间早于rqalpha 数据点时,按照rqalpha 数据起始点输出和储存数据

实际程序行为

在CTA 回测模块中下载数据,当输入开始时间早于rqalpha 数据点时,vnpy 抛出错误
Exception in thread Thread-9:
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 2940, in execute_sql
cursor.execute(sql, params or ())
sqlite3.IntegrityError: NOT NULL constraint failed: dbbardata.volume

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\ProgramData\Anaconda3_37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "D:\ProgramData\Anaconda3_37\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\vnpy\app\cta_backtester\engine.py", line 372, in run_downloading
database_manager.save_bar_data(data)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\vnpy\trader\database\database_sql.py", line 367, in save_bar_data
self.class_bar.save_all(ds)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\vnpy\trader\database\database_sql.py", line 145, in save_all
c).on_conflict_replace().execute()
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 1785, in inner
return method(self, database, *args, **kwargs)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 1856, in execute
return self._execute(database)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 2571, in _execute
return super(Insert, self)._execute(database)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 2320, in _execute
cursor = database.execute(self)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 2953, in execute
return self.execute_sql(sql, params, commit=commit)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 2947, in execute_sql
self.commit()
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 2729, in exit
reraise(new_type, new_type(*exc_args), traceback)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 183, in reraise
raise value.with_traceback(tb)
File "D:\ProgramData\Anaconda3_37\lib\site-packages\peewee.py", line 2940, in execute_sql
cursor.execute(sql, params or ())
peewee.IntegrityError: NOT NULL constraint failed: dbbardata.volume

重现步骤

针对Bug类型Issue,请提供具体重现步骤以及报错截图

@vnpy vnpy added the bug label May 21, 2019

@vnpy

This comment has been minimized.

Copy link
Owner

commented Jun 5, 2019

以上错误是因为2.0.2升级数据库导致的,请删除用户目录下的.vntrader目录后重启即可,和rqdata无关

@vnpy vnpy closed this Jun 5, 2019

@vnpy vnpy added invalid and removed bug labels Jun 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.