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

Traceback (most recent call last):
File "D:\Python\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "D:\Python\lib\threading.py", line 865, in run
self._target(self._args, **self._kwargs)
File "d:\VNPY\vn-py\vnpy\app\data_recorder\engine.py", line 71, in run
database_manager.save_tick_data([data])
File "d:\VNPY\vn-py\vnpy\trader\database\database_sql.py", line 378, in save_tick_data
self.class_tick.save_all(ds)
File "d:\VNPY\vn-py\vnpy\trader\database\database_sql.py", line 320, in save_all
DbTickData.insert_many(c).on_conflict_replace().execute()
File "D:\Python\lib\site-packages\peewee.py", line 1812, in inner
return method(self, database,
args, *kwargs)
File "D:\Python\lib\site-packages\peewee.py", line 1883, in execute
return self._execute(database)
File "D:\Python\lib\site-packages\peewee.py", line 2623, in _execute
return super(Insert, self)._execute(database)
File "D:\Python\lib\site-packages\peewee.py", line 2360, in _execute
cursor = database.execute(self)
File "D:\Python\lib\site-packages\peewee.py", line 3018, in execute
return self.execute_sql(sql, params, commit=commit)
File "D:\Python\lib\site-packages\peewee.py", line 3012, in execute_sql
self.commit()
File "D:\Python\lib\site-packages\peewee.py", line 2783, in exit
reraise(new_type, new_type(
exc_args), traceback)
File "D:\Python\lib\site-packages\peewee.py", line 183, in reraise
raise value.with_traceback(tb)
File "D:\Python\lib\site-packages\peewee.py", line 3005, in execute_sql
cursor.execute(sql, params or ())
File "D:\Python\lib\site-packages\pymysql\cursors.py", line 170, in execute
result = self._query(query)
File "D:\Python\lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
File "D:\Python\lib\site-packages\pymysql\connections.py", line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "D:\Python\lib\site-packages\pymysql\connections.py", line 732, in _read_query_result
result.read()
File "D:\Python\lib\site-packages\pymysql\connections.py", line 1075, in read
first_packet = self.connection._read_packet()
File "D:\Python\lib\site-packages\pymysql\connections.py", line 684, in _read_packet
packet.check_error()
File "D:\Python\lib\site-packages\pymysql\protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "D:\Python\lib\site-packages\pymysql\err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
peewee.InternalError: (1367, "Illegal double '1.79769313486232e+308' value found during parsing")

是不是存入mysql数据库时,需要判断一下是不是实数?该如何做呢?诚心发问。

Administrator
avatar
加入于:
帖子: 4220
声望: 241

这个是CTP底层接口传过来的浮点数为0时,数据溢出导致的问题,已经在DEV分支修复了

Member
avatar
加入于:
帖子: 4
声望: 1

谢谢解答!

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

小白龙 wrote:

Traceback (most recent call last):
File "D:\Python\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "D:\Python\lib\threading.py", line 865, in run
self._target(self._args, **self._kwargs)
File "d:\VNPY\vn-py\vnpy\app\data_recorder\engine.py", line 71, in run
database_manager.save_tick_data([data])
File "d:\VNPY\vn-py\vnpy\trader\database\database_sql.py", line 378, in save_tick_data
self.class_tick.save_all(ds)
File "d:\VNPY\vn-py\vnpy\trader\database\database_sql.py", line 320, in save_all
DbTickData.insert_many(c).on_conflict_replace().execute()
File "D:\Python\lib\site-packages\peewee.py", line 1812, in inner
return method(self, database,
args, *kwargs)
File "D:\Python\lib\site-packages\peewee.py", line 1883, in execute
return self._execute(database)
File "D:\Python\lib\site-packages\peewee.py", line 2623, in _execute
return super(Insert, self)._execute(database)
File "D:\Python\lib\site-packages\peewee.py", line 2360, in _execute
cursor = database.execute(self)
File "D:\Python\lib\site-packages\peewee.py", line 3018, in execute
return self.execute_sql(sql, params, commit=commit)
File "D:\Python\lib\site-packages\peewee.py", line 3012, in execute_sql
self.commit()
File "D:\Python\lib\site-packages\peewee.py", line 2783, in exit
reraise(new_type, new_type(
exc_args), traceback)
File "D:\Python\lib\site-packages\peewee.py", line 183, in reraise
raise value.with_traceback(tb)
File "D:\Python\lib\site-packages\peewee.py", line 3005, in execute_sql
cursor.execute(sql, params or ())
File "D:\Python\lib\site-packages\pymysql\cursors.py", line 170, in execute
result = self._query(query)
File "D:\Python\lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
File "D:\Python\lib\site-packages\pymysql\connections.py", line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "D:\Python\lib\site-packages\pymysql\connections.py", line 732, in _read_query_result
result.read()
File "D:\Python\lib\site-packages\pymysql\connections.py", line 1075, in read
first_packet = self.connection._read_packet()
File "D:\Python\lib\site-packages\pymysql\connections.py", line 684, in _read_packet
packet.check_error()
File "D:\Python\lib\site-packages\pymysql\protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "D:\Python\lib\site-packages\pymysql\err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
peewee.InternalError: (1367, "Illegal double '1.79769313486232e+308' value found during parsing")

是不是存入mysql数据库时,需要判断一下是不是实数?该如何做呢?诚心发问。

陈总好,我当前使用的2.08版本也存在此问题。请问是修改了哪个文件的哪个commit可以解决此问题?我不太想整体更新版本,只想通过小修改解决此问题。谢谢。

Administrator
avatar
加入于:
帖子: 4220
声望: 241

ctp_gateway.py中做了个数据范围检查

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

用Python的交易员 wrote:

ctp_gateway.py中做了个数据范围检查
感谢陈总,您的回复一直都是这么及时、给力。

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