=========================================================================
2025-08-14 16:25:15 Thu START TASK.01 future_1d future_rank
=========================================================================
2025-08-14 16:25:17,551 - future_1d - INFO - future_rank check=True check_last=7 start...
2025-08-14 16:25:17,634 - future_1d - INFO - future_rank date = 2025-08-06
2025-08-14 16:25:17,708 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='INE) done
2025-08-14 16:25:17,863 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='DCE) done
2025-08-14 16:25:17,961 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='GFEX) done
2025-08-14 16:25:18,157 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CZCE) done
2025-08-14 16:25:18,329 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='SHFE) done
2025-08-14 16:25:18,428 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CFFEX) done
2025-08-14 16:25:19,143 - future_1d - INFO - save future_rank 2025-08-06 completed
2025-08-14 16:25:27,952 - future_1d - INFO - future_rank date = 2025-08-07
2025-08-14 16:25:28,019 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='INE) done
2025-08-14 16:25:28,232 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='DCE) done
2025-08-14 16:25:28,345 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='GFEX) done
2025-08-14 16:25:28,539 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CZCE) done
2025-08-14 16:25:28,694 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='SHFE) done
2025-08-14 16:25:28,818 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CFFEX) done
2025-08-14 16:25:29,533 - future_1d - INFO - save future_rank 2025-08-07 completed
2025-08-14 16:25:33,718 - future_1d - INFO - future_rank date = 2025-08-08
2025-08-14 16:25:33,806 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='INE) done
2025-08-14 16:25:33,997 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='DCE) done
2025-08-14 16:25:34,093 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='GFEX) done
2025-08-14 16:25:34,337 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CZCE) done
2025-08-14 16:25:34,495 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='SHFE) done
2025-08-14 16:25:34,599 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CFFEX) done
2025-08-14 16:25:35,265 - future_1d - INFO - save future_rank 2025-08-08 completed
2025-08-14 16:25:40,180 - future_1d - INFO - future_rank date = 2025-08-11
2025-08-14 16:25:40,246 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='INE) done
2025-08-14 16:25:40,326 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='DCE) done
2025-08-14 16:25:40,434 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='GFEX) done
2025-08-14 16:25:40,685 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CZCE) done
2025-08-14 16:25:40,836 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='SHFE) done
2025-08-14 16:25:40,941 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CFFEX) done
2025-08-14 16:25:41,508 - future_1d - INFO - save future_rank 2025-08-11 completed
2025-08-14 16:25:49,036 - future_1d - INFO - future_rank date = 2025-08-12
2025-08-14 16:25:49,102 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='INE) done
2025-08-14 16:25:49,189 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='DCE) done
2025-08-14 16:25:49,386 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='GFEX) done
2025-08-14 16:25:49,588 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CZCE) done
2025-08-14 16:25:49,756 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='SHFE) done
2025-08-14 16:25:49,854 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CFFEX) done
2025-08-14 16:25:50,399 - future_1d - INFO - save future_rank 2025-08-12 completed
2025-08-14 16:25:53,921 - future_1d - INFO - future_rank date = 2025-08-13
2025-08-14 16:25:54,002 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='INE) done
2025-08-14 16:25:54,106 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='DCE) done
2025-08-14 16:25:54,194 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='GFEX) done
2025-08-14 16:25:54,383 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CZCE) done
2025-08-14 16:25:54,554 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='SHFE) done
2025-08-14 16:25:54,653 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CFFEX) done
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, "Data too long for column 'broker' at row 748")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/project/future_1d/future_rank.py", line 8, in
client.save_future_rank(check=True, check_last=7)
File "/root/project/future_1d/future1d_request.py", line 976, in save_future_rank
data_add.to_sql(tablebase.__tablename__, self.engine, index=False, if_exists='append', chunksize=1000)
File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 333, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pandas/core/generic.py", line 3106, in to_sql
return sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 844, in to_sql
return pandas_sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 2030, in to_sql
total_inserted = sql_engine.insert_records(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1579, in insert_records
raise err
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1570, in insert_records
return table.insert(chunksize=chunksize, method=method)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1121, in insert
num_inserted = exec_insert(conn, keys, chunk_iter)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1012, in _execute_insert
result = conn.execute(self.table.insert(), data)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1406, "Data too long for column 'broker' at row 748")
[SQL: INSERT INTO future_rank (date, symbol, broker, vol, vol_chg, long_hld, long_chg, short_hld, short_chg, exchange, variety, comd, created_at, updated_at) VALUES (%(date)s, %(symbol)s, %(broker)s, %(vol)s, %(vol_chg)s, %(long_hld)s, %(long_chg)s, %(short_hld)s, %(short_chg)s, %(exchange)s, %(variety)s, %(comd)s, %(created_at)s, %(updated_at)s)]
[parameters: [{'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '国联期货(代客)', 'vol': 2066.0, 'vol_chg': 1102.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 1303.0, 'short_chg': -285.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '大地期货(代客)', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 1111.0, 'short_chg': -10.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '宏源期货(代客)', 'vol': 1947.0, 'vol_chg': -2313.0, 'long_hld': 1378.0, 'long_chg': -171.0, 'short_hld': 1725.0, 'short_chg': -332.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '平安期货(代客)', 'vol': 2401.0, 'vol_chg': 1095.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 1667.0, 'short_chg': -1583.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '广发期货(代客)', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 1203.0, 'long_chg': -304.0, 'short_hld': 0.0, 'short_chg': 0.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '徽商期货(代客)', 'vol': 2609.0, 'vol_chg': 351.0, 'long_hld': 1545.0, 'long_chg': -311.0, 'short_hld': 1659.0, 'short_chg': -408.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '新湖期货(代客)', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 1461.0, 'short_chg': 0.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '方正中期(代客)', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 1081.0, 'long_chg': -626.0, 'short_hld': 0.0, 'short_chg': 0.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)} ... displaying 10 of 1000 total bound parameter sets ... {'date': '2025-08-13', 'symbol': 'AG2604', 'broker': '物产中大', 'vol': None, 'vol_chg': None, 'long_hld': 203.0, 'long_chg': 0.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AG', 'comd': 'ag', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)}, {'date': '2025-08-13', 'symbol': 'AG2604', 'broker': '财信期货', 'vol': 115.0, 'vol_chg': 75.0, 'long_hld': None, 'long_chg': None, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AG', 'comd': 'ag', 'created_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 753692), 'updated_at': datetime.datetime(2025, 8, 14, 16, 25, 54, 754107)}]]
(Background on this error at: https://sqlalche.me/e/20/9h9h)
=========================================================================
2025-08-14 16:26:48 Thu START TASK.01 future_1d future_rank
=========================================================================
2025-08-14 16:26:50,413 - future_1d - INFO - future_rank check=True check_last=7 start...
2025-08-14 16:26:50,495 - future_1d - INFO - future_rank date = 2025-08-06
2025-08-14 16:26:50,677 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='SHFE) done
2025-08-14 16:26:50,740 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='INE) done
2025-08-14 16:26:50,866 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='GFEX) done
2025-08-14 16:26:50,970 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CFFEX) done
2025-08-14 16:26:51,133 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='DCE) done
2025-08-14 16:26:51,350 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CZCE) done
2025-08-14 16:26:52,032 - future_1d - INFO - save future_rank 2025-08-06 completed
2025-08-14 16:26:55,566 - future_1d - INFO - future_rank date = 2025-08-07
2025-08-14 16:26:55,727 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='SHFE) done
2025-08-14 16:26:55,794 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='INE) done
2025-08-14 16:26:55,897 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='GFEX) done
2025-08-14 16:26:56,038 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CFFEX) done
2025-08-14 16:26:56,193 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='DCE) done
2025-08-14 16:26:56,443 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CZCE) done
2025-08-14 16:26:57,147 - future_1d - INFO - save future_rank 2025-08-07 completed
2025-08-14 16:27:00,870 - future_1d - INFO - future_rank date = 2025-08-08
2025-08-14 16:27:01,033 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='SHFE) done
2025-08-14 16:27:01,097 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='INE) done
2025-08-14 16:27:01,268 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='GFEX) done
2025-08-14 16:27:01,395 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CFFEX) done
2025-08-14 16:27:01,621 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='DCE) done
2025-08-14 16:27:01,942 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CZCE) done
2025-08-14 16:27:02,606 - future_1d - INFO - save future_rank 2025-08-08 completed
2025-08-14 16:27:10,458 - future_1d - INFO - future_rank date = 2025-08-11
2025-08-14 16:27:10,640 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='SHFE) done
2025-08-14 16:27:10,703 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='INE) done
2025-08-14 16:27:10,787 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='GFEX) done
2025-08-14 16:27:10,881 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CFFEX) done
2025-08-14 16:27:10,971 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='DCE) done
2025-08-14 16:27:11,161 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CZCE) done
2025-08-14 16:27:11,741 - future_1d - INFO - save future_rank 2025-08-11 completed
2025-08-14 16:27:14,875 - future_1d - INFO - future_rank date = 2025-08-12
2025-08-14 16:27:15,027 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='SHFE) done
2025-08-14 16:27:15,090 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='INE) done
2025-08-14 16:27:15,183 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='GFEX) done
2025-08-14 16:27:15,286 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CFFEX) done
2025-08-14 16:27:15,395 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='DCE) done
2025-08-14 16:27:15,579 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CZCE) done
2025-08-14 16:27:16,121 - future_1d - INFO - save future_rank 2025-08-12 completed
2025-08-14 16:27:26,131 - future_1d - INFO - future_rank date = 2025-08-13
2025-08-14 16:27:26,281 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='SHFE) done
2025-08-14 16:27:26,367 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='INE) done
2025-08-14 16:27:26,460 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='GFEX) done
2025-08-14 16:27:26,554 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CFFEX) done
2025-08-14 16:27:26,633 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='DCE) done
2025-08-14 16:27:26,903 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CZCE) done
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, "Data too long for column 'broker' at row 1")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/project/future_1d/future_rank.py", line 8, in
client.save_future_rank(check=True, check_last=7)
File "/root/project/future_1d/future1d_request.py", line 976, in save_future_rank
data_add.to_sql(tablebase.__tablename__, self.engine, index=False, if_exists='append', chunksize=1000)
File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 333, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pandas/core/generic.py", line 3106, in to_sql
return sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 844, in to_sql
return pandas_sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 2030, in to_sql
total_inserted = sql_engine.insert_records(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1579, in insert_records
raise err
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1570, in insert_records
return table.insert(chunksize=chunksize, method=method)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1121, in insert
num_inserted = exec_insert(conn, keys, chunk_iter)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1012, in _execute_insert
result = conn.execute(self.table.insert(), data)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1406, "Data too long for column 'broker' at row 1")
[SQL: INSERT INTO future_rank (date, symbol, broker, vol, vol_chg, long_hld, long_chg, short_hld, short_chg, exchange, variety, comd, created_at, updated_at) VALUES (%(date)s, %(symbol)s, %(broker)s, %(vol)s, %(vol_chg)s, %(long_hld)s, %(long_chg)s, %(short_hld)s, %(short_chg)s, %(exchange)s, %(variety)s, %(comd)s, %(created_at)s, %(updated_at)s)]
[parameters: [{'date': '2025-08-13', 'symbol': 'AD', 'broker': '期货公司会员/境外特殊经纪参与者', 'vol': 4696.0, 'vol_chg': 2504.0, 'long_hld': 10202.0, 'long_chg': 34.0, 'short_hld': 10202.0, 'short_chg': 34.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)}, {'date': '2025-08-13', 'symbol': 'AD', 'broker': '非期货公司会员/境外特殊非经纪参与者', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 0.0, 'short_chg': 0.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东亚期货', 'vol': None, 'vol_chg': None, 'long_hld': 148.0, 'long_chg': 3.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东吴期货', 'vol': 86.0, 'vol_chg': 40.0, 'long_hld': None, 'long_chg': None, 'short_hld': 191.0, 'short_chg': 22.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东海期货', 'vol': 151.0, 'vol_chg': 89.0, 'long_hld': 225.0, 'long_chg': 25.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东证期货', 'vol': 138.0, 'vol_chg': 77.0, 'long_hld': 841.0, 'long_chg': -40.0, 'short_hld': 583.0, 'short_chg': -2.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '中信建投', 'vol': 237.0, 'vol_chg': 217.0, 'long_hld': None, 'long_chg': None, 'short_hld': 252.0, 'short_chg': -197.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '中信期货', 'vol': 265.0, 'vol_chg': 143.0, 'long_hld': 761.0, 'long_chg': -7.0, 'short_hld': 656.0, 'short_chg': -4.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)} ... displaying 10 of 1000 total bound parameter sets ... {'date': '2025-08-13', 'symbol': 'CU2508', 'broker': '五矿期货', 'vol': 1340.0, 'vol_chg': 165.0, 'long_hld': None, 'long_chg': None, 'short_hld': 1335.0, 'short_chg': -910.0, 'exchange': 'SHFE', 'variety': 'CU', 'comd': 'cu', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)}, {'date': '2025-08-13', 'symbol': 'CU2508', 'broker': '光大期货', 'vol': 870.0, 'vol_chg': 200.0, 'long_hld': 180.0, 'long_chg': -235.0, 'short_hld': 320.0, 'short_chg': -255.0, 'exchange': 'SHFE', 'variety': 'CU', 'comd': 'cu', 'created_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 181647), 'updated_at': datetime.datetime(2025, 8, 14, 16, 27, 27, 182065)}]]
(Background on this error at: https://sqlalche.me/e/20/9h9h)
=========================================================================
2025-08-14 16:28:08 Thu START TASK.01 future_1d future_rank
=========================================================================
2025-08-14 16:28:10,547 - future_1d - INFO - future_rank check=True check_last=7 start...
2025-08-14 16:28:10,629 - future_1d - INFO - future_rank date = 2025-08-06
2025-08-14 16:28:10,709 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='INE) done
2025-08-14 16:28:10,869 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='SHFE) done
2025-08-14 16:28:11,024 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='DCE) done
2025-08-14 16:28:11,255 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CZCE) done
2025-08-14 16:28:11,374 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CFFEX) done
2025-08-14 16:28:11,497 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='GFEX) done
2025-08-14 16:28:12,191 - future_1d - INFO - save future_rank 2025-08-06 completed
2025-08-14 16:28:21,501 - future_1d - INFO - future_rank date = 2025-08-07
2025-08-14 16:28:21,584 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='INE) done
2025-08-14 16:28:21,759 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='SHFE) done
2025-08-14 16:28:21,913 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='DCE) done
2025-08-14 16:28:22,165 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CZCE) done
2025-08-14 16:28:22,275 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CFFEX) done
2025-08-14 16:28:22,414 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='GFEX) done
2025-08-14 16:28:23,131 - future_1d - INFO - save future_rank 2025-08-07 completed
2025-08-14 16:28:27,005 - future_1d - INFO - future_rank date = 2025-08-08
2025-08-14 16:28:27,086 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='INE) done
2025-08-14 16:28:27,263 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='SHFE) done
2025-08-14 16:28:27,439 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='DCE) done
2025-08-14 16:28:27,617 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CZCE) done
2025-08-14 16:28:27,728 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CFFEX) done
2025-08-14 16:28:27,820 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='GFEX) done
2025-08-14 16:28:28,520 - future_1d - INFO - save future_rank 2025-08-08 completed
2025-08-14 16:28:34,886 - future_1d - INFO - future_rank date = 2025-08-11
2025-08-14 16:28:34,954 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='INE) done
2025-08-14 16:28:35,125 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='SHFE) done
2025-08-14 16:28:35,213 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='DCE) done
2025-08-14 16:28:35,402 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CZCE) done
2025-08-14 16:28:35,512 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CFFEX) done
2025-08-14 16:28:35,606 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='GFEX) done
2025-08-14 16:28:36,197 - future_1d - INFO - save future_rank 2025-08-11 completed
2025-08-14 16:28:40,940 - future_1d - INFO - future_rank date = 2025-08-12
2025-08-14 16:28:41,019 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='INE) done
2025-08-14 16:28:41,168 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='SHFE) done
2025-08-14 16:28:41,261 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='DCE) done
2025-08-14 16:28:41,437 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CZCE) done
2025-08-14 16:28:41,576 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CFFEX) done
2025-08-14 16:28:41,687 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='GFEX) done
2025-08-14 16:28:42,212 - future_1d - INFO - save future_rank 2025-08-12 completed
2025-08-14 16:28:47,767 - future_1d - INFO - future_rank date = 2025-08-13
2025-08-14 16:28:47,832 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='INE) done
2025-08-14 16:28:48,015 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='SHFE) done
2025-08-14 16:28:48,097 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='DCE) done
2025-08-14 16:28:48,275 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CZCE) done
2025-08-14 16:28:48,380 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CFFEX) done
2025-08-14 16:28:48,487 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='GFEX) done
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, "Data too long for column 'broker' at row 1")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/project/future_1d/future_rank.py", line 8, in
client.save_future_rank(check=True, check_last=7)
File "/root/project/future_1d/future1d_request.py", line 976, in save_future_rank
data_add.to_sql(tablebase.__tablename__, self.engine, index=False, if_exists='append', chunksize=1000)
File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 333, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pandas/core/generic.py", line 3106, in to_sql
return sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 844, in to_sql
return pandas_sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 2030, in to_sql
total_inserted = sql_engine.insert_records(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1579, in insert_records
raise err
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1570, in insert_records
return table.insert(chunksize=chunksize, method=method)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1121, in insert
num_inserted = exec_insert(conn, keys, chunk_iter)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1012, in _execute_insert
result = conn.execute(self.table.insert(), data)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1406, "Data too long for column 'broker' at row 1")
[SQL: INSERT INTO future_rank (date, symbol, broker, vol, vol_chg, long_hld, long_chg, short_hld, short_chg, exchange, variety, comd, created_at, updated_at) VALUES (%(date)s, %(symbol)s, %(broker)s, %(vol)s, %(vol_chg)s, %(long_hld)s, %(long_chg)s, %(short_hld)s, %(short_chg)s, %(exchange)s, %(variety)s, %(comd)s, %(created_at)s, %(updated_at)s)]
[parameters: [{'date': '2025-08-13', 'symbol': 'AD', 'broker': '期货公司会员/境外特殊经纪参与者', 'vol': 4696.0, 'vol_chg': 2504.0, 'long_hld': 10202.0, 'long_chg': 34.0, 'short_hld': 10202.0, 'short_chg': 34.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)}, {'date': '2025-08-13', 'symbol': 'AD', 'broker': '非期货公司会员/境外特殊非经纪参与者', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 0.0, 'short_chg': 0.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东亚期货', 'vol': None, 'vol_chg': None, 'long_hld': 148.0, 'long_chg': 3.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东吴期货', 'vol': 86.0, 'vol_chg': 40.0, 'long_hld': None, 'long_chg': None, 'short_hld': 191.0, 'short_chg': 22.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东海期货', 'vol': 151.0, 'vol_chg': 89.0, 'long_hld': 225.0, 'long_chg': 25.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东证期货', 'vol': 138.0, 'vol_chg': 77.0, 'long_hld': 841.0, 'long_chg': -40.0, 'short_hld': 583.0, 'short_chg': -2.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '中信建投', 'vol': 237.0, 'vol_chg': 217.0, 'long_hld': None, 'long_chg': None, 'short_hld': 252.0, 'short_chg': -197.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '中信期货', 'vol': 265.0, 'vol_chg': 143.0, 'long_hld': 761.0, 'long_chg': -7.0, 'short_hld': 656.0, 'short_chg': -4.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)} ... displaying 10 of 1000 total bound parameter sets ... {'date': '2025-08-13', 'symbol': 'CU2508', 'broker': '五矿期货', 'vol': 1340.0, 'vol_chg': 165.0, 'long_hld': None, 'long_chg': None, 'short_hld': 1335.0, 'short_chg': -910.0, 'exchange': 'SHFE', 'variety': 'CU', 'comd': 'cu', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)}, {'date': '2025-08-13', 'symbol': 'CU2508', 'broker': '光大期货', 'vol': 870.0, 'vol_chg': 200.0, 'long_hld': 180.0, 'long_chg': -235.0, 'short_hld': 320.0, 'short_chg': -255.0, 'exchange': 'SHFE', 'variety': 'CU', 'comd': 'cu', 'created_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783186), 'updated_at': datetime.datetime(2025, 8, 14, 16, 28, 48, 783649)}]]
(Background on this error at: https://sqlalche.me/e/20/9h9h)
=========================================================================
2025-08-14 16:29:51 Thu START TASK.01 future_1d future_rank
=========================================================================
2025-08-14 16:29:53,791 - future_1d - INFO - future_rank check=True check_last=7 start...
2025-08-14 16:29:53,872 - future_1d - INFO - future_rank date = 2025-08-06
2025-08-14 16:29:54,057 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='DCE) done
2025-08-14 16:29:54,284 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CZCE) done
2025-08-14 16:29:54,444 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='SHFE) done
2025-08-14 16:29:54,543 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CFFEX) done
2025-08-14 16:29:54,622 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='INE) done
2025-08-14 16:29:54,714 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='GFEX) done
2025-08-14 16:29:55,413 - future_1d - INFO - save future_rank 2025-08-06 completed
2025-08-14 16:29:58,677 - future_1d - INFO - future_rank date = 2025-08-07
2025-08-14 16:29:58,840 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='DCE) done
2025-08-14 16:29:59,015 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CZCE) done
2025-08-14 16:29:59,217 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='SHFE) done
2025-08-14 16:29:59,324 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CFFEX) done
2025-08-14 16:29:59,384 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='INE) done
2025-08-14 16:29:59,499 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='GFEX) done
2025-08-14 16:30:00,201 - future_1d - INFO - save future_rank 2025-08-07 completed
2025-08-14 16:30:04,556 - future_1d - INFO - future_rank date = 2025-08-08
2025-08-14 16:30:04,741 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='DCE) done
2025-08-14 16:30:04,946 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CZCE) done
2025-08-14 16:30:05,123 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='SHFE) done
2025-08-14 16:30:05,260 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CFFEX) done
2025-08-14 16:30:05,327 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='INE) done
2025-08-14 16:30:05,439 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='GFEX) done
2025-08-14 16:30:06,097 - future_1d - INFO - save future_rank 2025-08-08 completed
2025-08-14 16:30:09,341 - future_1d - INFO - future_rank date = 2025-08-11
2025-08-14 16:30:09,425 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='DCE) done
2025-08-14 16:30:09,646 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CZCE) done
2025-08-14 16:30:09,815 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='SHFE) done
2025-08-14 16:30:09,911 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CFFEX) done
2025-08-14 16:30:09,970 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='INE) done
2025-08-14 16:30:10,079 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='GFEX) done
2025-08-14 16:30:10,639 - future_1d - INFO - save future_rank 2025-08-11 completed
2025-08-14 16:30:17,895 - future_1d - INFO - future_rank date = 2025-08-12
2025-08-14 16:30:17,999 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='DCE) done
2025-08-14 16:30:18,258 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CZCE) done
2025-08-14 16:30:18,413 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='SHFE) done
2025-08-14 16:30:18,510 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CFFEX) done
2025-08-14 16:30:18,574 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='INE) done
2025-08-14 16:30:18,692 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='GFEX) done
2025-08-14 16:30:19,221 - future_1d - INFO - save future_rank 2025-08-12 completed
2025-08-14 16:30:24,206 - future_1d - INFO - future_rank date = 2025-08-13
2025-08-14 16:30:24,293 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='DCE) done
2025-08-14 16:30:24,485 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CZCE) done
2025-08-14 16:30:24,643 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='SHFE) done
2025-08-14 16:30:24,750 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CFFEX) done
2025-08-14 16:30:24,830 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='INE) done
2025-08-14 16:30:24,919 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='GFEX) done
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, "Data too long for column 'broker' at row 748")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/project/future_1d/future_rank.py", line 8, in
client.save_future_rank(check=True, check_last=7)
File "/root/project/future_1d/future1d_request.py", line 976, in save_future_rank
data_add.to_sql(tablebase.__tablename__, self.engine, index=False, if_exists='append', chunksize=1000)
File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 333, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pandas/core/generic.py", line 3106, in to_sql
return sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 844, in to_sql
return pandas_sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 2030, in to_sql
total_inserted = sql_engine.insert_records(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1579, in insert_records
raise err
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1570, in insert_records
return table.insert(chunksize=chunksize, method=method)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1121, in insert
num_inserted = exec_insert(conn, keys, chunk_iter)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1012, in _execute_insert
result = conn.execute(self.table.insert(), data)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1406, "Data too long for column 'broker' at row 748")
[SQL: INSERT INTO future_rank (date, symbol, broker, vol, vol_chg, long_hld, long_chg, short_hld, short_chg, exchange, variety, comd, created_at, updated_at) VALUES (%(date)s, %(symbol)s, %(broker)s, %(vol)s, %(vol_chg)s, %(long_hld)s, %(long_chg)s, %(short_hld)s, %(short_chg)s, %(exchange)s, %(variety)s, %(comd)s, %(created_at)s, %(updated_at)s)]
[parameters: [{'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '国联期货(代客)', 'vol': 2066.0, 'vol_chg': 1102.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 1303.0, 'short_chg': -285.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '大地期货(代客)', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 1111.0, 'short_chg': -10.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '宏源期货(代客)', 'vol': 1947.0, 'vol_chg': -2313.0, 'long_hld': 1378.0, 'long_chg': -171.0, 'short_hld': 1725.0, 'short_chg': -332.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '平安期货(代客)', 'vol': 2401.0, 'vol_chg': 1095.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 1667.0, 'short_chg': -1583.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '广发期货(代客)', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 1203.0, 'long_chg': -304.0, 'short_hld': 0.0, 'short_chg': 0.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '徽商期货(代客)', 'vol': 2609.0, 'vol_chg': 351.0, 'long_hld': 1545.0, 'long_chg': -311.0, 'short_hld': 1659.0, 'short_chg': -408.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '新湖期货(代客)', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 1461.0, 'short_chg': 0.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)}, {'date': '2025-08-13', 'symbol': 'UR2509', 'broker': '方正中期(代客)', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 1081.0, 'long_chg': -626.0, 'short_hld': 0.0, 'short_chg': 0.0, 'exchange': 'CZCE', 'variety': 'UR', 'comd': 'UR', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)} ... displaying 10 of 1000 total bound parameter sets ... {'date': '2025-08-13', 'symbol': 'AG2604', 'broker': '物产中大', 'vol': None, 'vol_chg': None, 'long_hld': 203.0, 'long_chg': 0.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AG', 'comd': 'ag', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)}, {'date': '2025-08-13', 'symbol': 'AG2604', 'broker': '财信期货', 'vol': 115.0, 'vol_chg': 75.0, 'long_hld': None, 'long_chg': None, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AG', 'comd': 'ag', 'created_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195176), 'updated_at': datetime.datetime(2025, 8, 14, 16, 30, 25, 195625)}]]
(Background on this error at: https://sqlalche.me/e/20/9h9h)
=========================================================================
2025-08-14 18:25:11 Thu START TASK.01 future_1d future_rank
=========================================================================
2025-08-14 18:25:13,360 - future_1d - INFO - future_rank check=True check_last=7 start...
2025-08-14 18:25:13,463 - future_1d - INFO - future_rank date = 2025-08-06
2025-08-14 18:25:13,746 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='DCE) done
2025-08-14 18:25:13,857 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='INE) done
2025-08-14 18:25:14,141 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CZCE) done
2025-08-14 18:25:14,267 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='GFEX) done
2025-08-14 18:25:14,364 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CFFEX) done
2025-08-14 18:25:14,535 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='SHFE) done
2025-08-14 18:25:15,228 - future_1d - INFO - save future_rank 2025-08-06 completed
2025-08-14 18:25:19,749 - future_1d - INFO - future_rank date = 2025-08-07
2025-08-14 18:25:19,916 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='DCE) done
2025-08-14 18:25:19,981 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='INE) done
2025-08-14 18:25:20,182 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CZCE) done
2025-08-14 18:25:20,369 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='GFEX) done
2025-08-14 18:25:20,492 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CFFEX) done
2025-08-14 18:25:20,660 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='SHFE) done
2025-08-14 18:25:21,394 - future_1d - INFO - save future_rank 2025-08-07 completed
2025-08-14 18:25:25,578 - future_1d - INFO - future_rank date = 2025-08-08
2025-08-14 18:25:25,774 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='DCE) done
2025-08-14 18:25:25,905 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='INE) done
2025-08-14 18:25:26,102 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CZCE) done
2025-08-14 18:25:26,234 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='GFEX) done
2025-08-14 18:25:26,390 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CFFEX) done
2025-08-14 18:25:26,566 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='SHFE) done
2025-08-14 18:25:27,263 - future_1d - INFO - save future_rank 2025-08-08 completed
2025-08-14 18:25:30,736 - future_1d - INFO - future_rank date = 2025-08-11
2025-08-14 18:25:31,360 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='DCE) done
2025-08-14 18:25:31,544 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='INE) done
2025-08-14 18:25:31,771 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CZCE) done
2025-08-14 18:25:31,867 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='GFEX) done
2025-08-14 18:25:31,982 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CFFEX) done
2025-08-14 18:25:32,217 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='SHFE) done
2025-08-14 18:25:32,785 - future_1d - INFO - save future_rank 2025-08-11 completed
2025-08-14 18:25:41,004 - future_1d - INFO - future_rank date = 2025-08-12
2025-08-14 18:25:41,104 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='DCE) done
2025-08-14 18:25:41,166 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='INE) done
2025-08-14 18:25:41,374 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CZCE) done
2025-08-14 18:25:41,460 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='GFEX) done
2025-08-14 18:25:41,568 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CFFEX) done
2025-08-14 18:25:41,710 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='SHFE) done
2025-08-14 18:25:42,246 - future_1d - INFO - save future_rank 2025-08-12 completed
2025-08-14 18:25:49,413 - future_1d - INFO - future_rank date = 2025-08-13
2025-08-14 18:25:49,506 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='DCE) done
2025-08-14 18:25:49,569 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='INE) done
2025-08-14 18:25:49,788 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CZCE) done
2025-08-14 18:25:49,880 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='GFEX) done
2025-08-14 18:25:50,009 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CFFEX) done
2025-08-14 18:25:50,175 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='SHFE) done
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, "Data too long for column 'broker' at row 467")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/project/future_1d/future_rank.py", line 8, in
client.save_future_rank(check=True, check_last=7)
File "/root/project/future_1d/future1d_request.py", line 976, in save_future_rank
data_add.to_sql(tablebase.__tablename__, self.engine, index=False, if_exists='append', chunksize=1000)
File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 333, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pandas/core/generic.py", line 3106, in to_sql
return sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 844, in to_sql
return pandas_sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 2030, in to_sql
total_inserted = sql_engine.insert_records(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1579, in insert_records
raise err
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1570, in insert_records
return table.insert(chunksize=chunksize, method=method)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1121, in insert
num_inserted = exec_insert(conn, keys, chunk_iter)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1012, in _execute_insert
result = conn.execute(self.table.insert(), data)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1406, "Data too long for column 'broker' at row 467")
[SQL: INSERT INTO future_rank (date, symbol, broker, vol, vol_chg, long_hld, long_chg, short_hld, short_chg, exchange, variety, comd, created_at, updated_at) VALUES (%(date)s, %(symbol)s, %(broker)s, %(vol)s, %(vol_chg)s, %(long_hld)s, %(long_chg)s, %(short_hld)s, %(short_chg)s, %(exchange)s, %(variety)s, %(comd)s, %(created_at)s, %(updated_at)s)]
[parameters: [{'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '瑞达期货(代客)', 'vol': 240.0, 'vol_chg': -25.0, 'long_hld': 117.0, 'long_chg': 19.0, 'short_hld': 109.0, 'short_chg': 15.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)}, {'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '瑞银期货(代客)', 'vol': None, 'vol_chg': None, 'long_hld': None, 'long_chg': None, 'short_hld': 180.0, 'short_chg': 0.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)}, {'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '申银万国(代客)', 'vol': 213.0, 'vol_chg': -6.0, 'long_hld': 81.0, 'long_chg': -6.0, 'short_hld': 310.0, 'short_chg': 55.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)}, {'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '金元期货(代客)', 'vol': 430.0, 'vol_chg': 34.0, 'long_hld': 82.0, 'long_chg': -8.0, 'short_hld': None, 'short_chg': None, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)}, {'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '银河期货(代客)', 'vol': 739.0, 'vol_chg': 109.0, 'long_hld': 323.0, 'long_chg': -17.0, 'short_hld': 354.0, 'short_chg': -398.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)}, {'date': '2025-08-13', 'symbol': 'IH2509', 'broker': '东方财富(代客)', 'vol': 1200.0, 'vol_chg': 57.0, 'long_hld': None, 'long_chg': None, 'short_hld': None, 'short_chg': None, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)}, {'date': '2025-08-13', 'symbol': 'IH2509', 'broker': '东证期货(代客)', 'vol': 4026.0, 'vol_chg': 375.0, 'long_hld': 2150.0, 'long_chg': 212.0, 'short_hld': 3077.0, 'short_chg': 356.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)}, {'date': '2025-08-13', 'symbol': 'IH2509', 'broker': '中信建投(代客)', 'vol': 1581.0, 'vol_chg': 33.0, 'long_hld': 1399.0, 'long_chg': 150.0, 'short_hld': 492.0, 'short_chg': 79.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)} ... displaying 10 of 1000 total bound parameter sets ... {'date': '2025-08-13', 'symbol': 'AO2510', 'broker': '招商期货', 'vol': 2033.0, 'vol_chg': -1025.0, 'long_hld': 6434.0, 'long_chg': -4.0, 'short_hld': 5713.0, 'short_chg': -47.0, 'exchange': 'SHFE', 'variety': 'AO', 'comd': 'ao', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)}, {'date': '2025-08-13', 'symbol': 'AO2510', 'broker': '方正中期', 'vol': 1708.0, 'vol_chg': -568.0, 'long_hld': 1393.0, 'long_chg': 599.0, 'short_hld': 1266.0, 'short_chg': 379.0, 'exchange': 'SHFE', 'variety': 'AO', 'comd': 'ao', 'created_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467447), 'updated_at': datetime.datetime(2025, 8, 14, 18, 25, 50, 467918)}]]
(Background on this error at: https://sqlalche.me/e/20/9h9h)
=========================================================================
2025-08-14 18:26:35 Thu START TASK.01 future_1d future_rank
=========================================================================
2025-08-14 18:26:37,142 - future_1d - INFO - future_rank check=True check_last=7 start...
2025-08-14 18:26:37,224 - future_1d - INFO - future_rank date = 2025-08-06
2025-08-14 18:26:37,410 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='DCE) done
2025-08-14 18:26:37,638 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CZCE) done
2025-08-14 18:26:37,744 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CFFEX) done
2025-08-14 18:26:37,820 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='INE) done
2025-08-14 18:26:37,965 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='SHFE) done
2025-08-14 18:26:38,080 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='GFEX) done
2025-08-14 18:26:38,760 - future_1d - INFO - save future_rank 2025-08-06 completed
2025-08-14 18:26:48,379 - future_1d - INFO - future_rank date = 2025-08-07
2025-08-14 18:26:48,617 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='DCE) done
2025-08-14 18:26:48,832 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CZCE) done
2025-08-14 18:26:48,953 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CFFEX) done
2025-08-14 18:26:49,072 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='INE) done
2025-08-14 18:26:49,298 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='SHFE) done
2025-08-14 18:26:49,404 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='GFEX) done
2025-08-14 18:26:50,128 - future_1d - INFO - save future_rank 2025-08-07 completed
2025-08-14 18:26:58,052 - future_1d - INFO - future_rank date = 2025-08-08
2025-08-14 18:26:58,258 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='DCE) done
2025-08-14 18:26:58,472 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CZCE) done
2025-08-14 18:26:58,571 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CFFEX) done
2025-08-14 18:26:58,638 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='INE) done
2025-08-14 18:26:58,838 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='SHFE) done
2025-08-14 18:26:58,941 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='GFEX) done
2025-08-14 18:26:59,603 - future_1d - INFO - save future_rank 2025-08-08 completed
2025-08-14 18:27:08,893 - future_1d - INFO - future_rank date = 2025-08-11
2025-08-14 18:27:08,995 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='DCE) done
2025-08-14 18:27:09,215 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CZCE) done
2025-08-14 18:27:09,317 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CFFEX) done
2025-08-14 18:27:09,379 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='INE) done
2025-08-14 18:27:09,585 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='SHFE) done
2025-08-14 18:27:09,681 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='GFEX) done
2025-08-14 18:27:10,250 - future_1d - INFO - save future_rank 2025-08-11 completed
2025-08-14 18:27:17,708 - future_1d - INFO - future_rank date = 2025-08-12
2025-08-14 18:27:17,821 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='DCE) done
2025-08-14 18:27:18,055 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CZCE) done
2025-08-14 18:27:18,163 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CFFEX) done
2025-08-14 18:27:18,231 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='INE) done
2025-08-14 18:27:18,433 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='SHFE) done
2025-08-14 18:27:18,560 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='GFEX) done
2025-08-14 18:27:19,082 - future_1d - INFO - save future_rank 2025-08-12 completed
2025-08-14 18:27:25,699 - future_1d - INFO - future_rank date = 2025-08-13
2025-08-14 18:27:25,803 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='DCE) done
2025-08-14 18:27:26,032 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CZCE) done
2025-08-14 18:27:26,134 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CFFEX) done
2025-08-14 18:27:26,197 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='INE) done
2025-08-14 18:27:26,366 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='SHFE) done
2025-08-14 18:27:26,461 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='GFEX) done
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, "Data too long for column 'broker' at row 467")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/project/future_1d/future_rank.py", line 8, in
client.save_future_rank(check=True, check_last=7)
File "/root/project/future_1d/future1d_request.py", line 976, in save_future_rank
data_add.to_sql(tablebase.__tablename__, self.engine, index=False, if_exists='append', chunksize=1000)
File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 333, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pandas/core/generic.py", line 3106, in to_sql
return sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 844, in to_sql
return pandas_sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 2030, in to_sql
total_inserted = sql_engine.insert_records(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1579, in insert_records
raise err
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1570, in insert_records
return table.insert(chunksize=chunksize, method=method)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1121, in insert
num_inserted = exec_insert(conn, keys, chunk_iter)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1012, in _execute_insert
result = conn.execute(self.table.insert(), data)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1406, "Data too long for column 'broker' at row 467")
[SQL: INSERT INTO future_rank (date, symbol, broker, vol, vol_chg, long_hld, long_chg, short_hld, short_chg, exchange, variety, comd, created_at, updated_at) VALUES (%(date)s, %(symbol)s, %(broker)s, %(vol)s, %(vol_chg)s, %(long_hld)s, %(long_chg)s, %(short_hld)s, %(short_chg)s, %(exchange)s, %(variety)s, %(comd)s, %(created_at)s, %(updated_at)s)]
[parameters: [{'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '瑞达期货(代客)', 'vol': 240.0, 'vol_chg': -25.0, 'long_hld': 117.0, 'long_chg': 19.0, 'short_hld': 109.0, 'short_chg': 15.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)}, {'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '瑞银期货(代客)', 'vol': None, 'vol_chg': None, 'long_hld': None, 'long_chg': None, 'short_hld': 180.0, 'short_chg': 0.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)}, {'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '申银万国(代客)', 'vol': 213.0, 'vol_chg': -6.0, 'long_hld': 81.0, 'long_chg': -6.0, 'short_hld': 310.0, 'short_chg': 55.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)}, {'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '金元期货(代客)', 'vol': 430.0, 'vol_chg': 34.0, 'long_hld': 82.0, 'long_chg': -8.0, 'short_hld': None, 'short_chg': None, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)}, {'date': '2025-08-13', 'symbol': 'IH2508', 'broker': '银河期货(代客)', 'vol': 739.0, 'vol_chg': 109.0, 'long_hld': 323.0, 'long_chg': -17.0, 'short_hld': 354.0, 'short_chg': -398.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)}, {'date': '2025-08-13', 'symbol': 'IH2509', 'broker': '东方财富(代客)', 'vol': 1200.0, 'vol_chg': 57.0, 'long_hld': None, 'long_chg': None, 'short_hld': None, 'short_chg': None, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)}, {'date': '2025-08-13', 'symbol': 'IH2509', 'broker': '东证期货(代客)', 'vol': 4026.0, 'vol_chg': 375.0, 'long_hld': 2150.0, 'long_chg': 212.0, 'short_hld': 3077.0, 'short_chg': 356.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)}, {'date': '2025-08-13', 'symbol': 'IH2509', 'broker': '中信建投(代客)', 'vol': 1581.0, 'vol_chg': 33.0, 'long_hld': 1399.0, 'long_chg': 150.0, 'short_hld': 492.0, 'short_chg': 79.0, 'exchange': 'CFFEX', 'variety': 'IH', 'comd': 'IH', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)} ... displaying 10 of 1000 total bound parameter sets ... {'date': '2025-08-13', 'symbol': 'AO2510', 'broker': '招商期货', 'vol': 2033.0, 'vol_chg': -1025.0, 'long_hld': 6434.0, 'long_chg': -4.0, 'short_hld': 5713.0, 'short_chg': -47.0, 'exchange': 'SHFE', 'variety': 'AO', 'comd': 'ao', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)}, {'date': '2025-08-13', 'symbol': 'AO2510', 'broker': '方正中期', 'vol': 1708.0, 'vol_chg': -568.0, 'long_hld': 1393.0, 'long_chg': 599.0, 'short_hld': 1266.0, 'short_chg': 379.0, 'exchange': 'SHFE', 'variety': 'AO', 'comd': 'ao', 'created_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 796855), 'updated_at': datetime.datetime(2025, 8, 14, 18, 27, 26, 797279)}]]
(Background on this error at: https://sqlalche.me/e/20/9h9h)
=========================================================================
2025-08-14 18:28:14 Thu START TASK.01 future_1d future_rank
=========================================================================
2025-08-14 18:28:16,401 - future_1d - INFO - future_rank check=True check_last=7 start...
2025-08-14 18:28:16,484 - future_1d - INFO - future_rank date = 2025-08-06
2025-08-14 18:28:16,647 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='SHFE) done
2025-08-14 18:28:16,748 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CFFEX) done
2025-08-14 18:28:16,948 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CZCE) done
2025-08-14 18:28:17,121 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='DCE) done
2025-08-14 18:28:17,292 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='GFEX) done
2025-08-14 18:28:17,408 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='INE) done
2025-08-14 18:28:18,064 - future_1d - INFO - save future_rank 2025-08-06 completed
2025-08-14 18:28:23,600 - future_1d - INFO - future_rank date = 2025-08-07
2025-08-14 18:28:23,770 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='SHFE) done
2025-08-14 18:28:23,898 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CFFEX) done
2025-08-14 18:28:24,082 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CZCE) done
2025-08-14 18:28:24,243 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='DCE) done
2025-08-14 18:28:24,342 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='GFEX) done
2025-08-14 18:28:24,423 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='INE) done
2025-08-14 18:28:25,129 - future_1d - INFO - save future_rank 2025-08-07 completed
2025-08-14 18:28:29,463 - future_1d - INFO - future_rank date = 2025-08-08
2025-08-14 18:28:29,706 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='SHFE) done
2025-08-14 18:28:29,810 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CFFEX) done
2025-08-14 18:28:30,015 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CZCE) done
2025-08-14 18:28:30,192 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='DCE) done
2025-08-14 18:28:30,289 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='GFEX) done
2025-08-14 18:28:30,366 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='INE) done
2025-08-14 18:28:31,020 - future_1d - INFO - save future_rank 2025-08-08 completed
2025-08-14 18:28:35,385 - future_1d - INFO - future_rank date = 2025-08-11
2025-08-14 18:28:35,545 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='SHFE) done
2025-08-14 18:28:35,634 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CFFEX) done
2025-08-14 18:28:35,834 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CZCE) done
2025-08-14 18:28:35,918 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='DCE) done
2025-08-14 18:28:36,014 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='GFEX) done
2025-08-14 18:28:36,093 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='INE) done
2025-08-14 18:28:36,670 - future_1d - INFO - save future_rank 2025-08-11 completed
2025-08-14 18:28:42,484 - future_1d - INFO - future_rank date = 2025-08-12
2025-08-14 18:28:42,672 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='SHFE) done
2025-08-14 18:28:42,782 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CFFEX) done
2025-08-14 18:28:43,004 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CZCE) done
2025-08-14 18:28:43,080 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='DCE) done
2025-08-14 18:28:43,183 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='GFEX) done
2025-08-14 18:28:43,259 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='INE) done
2025-08-14 18:28:43,769 - future_1d - INFO - save future_rank 2025-08-12 completed
2025-08-14 18:28:53,709 - future_1d - INFO - future_rank date = 2025-08-13
2025-08-14 18:28:53,874 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='SHFE) done
2025-08-14 18:28:53,970 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CFFEX) done
2025-08-14 18:28:54,217 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CZCE) done
2025-08-14 18:28:54,300 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='DCE) done
2025-08-14 18:28:54,403 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='GFEX) done
2025-08-14 18:28:54,482 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='INE) done
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, "Data too long for column 'broker' at row 1")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/project/future_1d/future_rank.py", line 8, in
client.save_future_rank(check=True, check_last=7)
File "/root/project/future_1d/future1d_request.py", line 976, in save_future_rank
data_add.to_sql(tablebase.__tablename__, self.engine, index=False, if_exists='append', chunksize=1000)
File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 333, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pandas/core/generic.py", line 3106, in to_sql
return sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 844, in to_sql
return pandas_sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 2030, in to_sql
total_inserted = sql_engine.insert_records(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1579, in insert_records
raise err
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1570, in insert_records
return table.insert(chunksize=chunksize, method=method)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1121, in insert
num_inserted = exec_insert(conn, keys, chunk_iter)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1012, in _execute_insert
result = conn.execute(self.table.insert(), data)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1406, "Data too long for column 'broker' at row 1")
[SQL: INSERT INTO future_rank (date, symbol, broker, vol, vol_chg, long_hld, long_chg, short_hld, short_chg, exchange, variety, comd, created_at, updated_at) VALUES (%(date)s, %(symbol)s, %(broker)s, %(vol)s, %(vol_chg)s, %(long_hld)s, %(long_chg)s, %(short_hld)s, %(short_chg)s, %(exchange)s, %(variety)s, %(comd)s, %(created_at)s, %(updated_at)s)]
[parameters: [{'date': '2025-08-13', 'symbol': 'AD', 'broker': '期货公司会员/境外特殊经纪参与者', 'vol': 4696.0, 'vol_chg': 2504.0, 'long_hld': 10202.0, 'long_chg': 34.0, 'short_hld': 10202.0, 'short_chg': 34.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)}, {'date': '2025-08-13', 'symbol': 'AD', 'broker': '非期货公司会员/境外特殊非经纪参与者', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 0.0, 'short_chg': 0.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东亚期货', 'vol': None, 'vol_chg': None, 'long_hld': 148.0, 'long_chg': 3.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东吴期货', 'vol': 86.0, 'vol_chg': 40.0, 'long_hld': None, 'long_chg': None, 'short_hld': 191.0, 'short_chg': 22.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东海期货', 'vol': 151.0, 'vol_chg': 89.0, 'long_hld': 225.0, 'long_chg': 25.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东证期货', 'vol': 138.0, 'vol_chg': 77.0, 'long_hld': 841.0, 'long_chg': -40.0, 'short_hld': 583.0, 'short_chg': -2.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '中信建投', 'vol': 237.0, 'vol_chg': 217.0, 'long_hld': None, 'long_chg': None, 'short_hld': 252.0, 'short_chg': -197.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '中信期货', 'vol': 265.0, 'vol_chg': 143.0, 'long_hld': 761.0, 'long_chg': -7.0, 'short_hld': 656.0, 'short_chg': -4.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)} ... displaying 10 of 1000 total bound parameter sets ... {'date': '2025-08-13', 'symbol': 'CU2508', 'broker': '五矿期货', 'vol': 1340.0, 'vol_chg': 165.0, 'long_hld': None, 'long_chg': None, 'short_hld': 1335.0, 'short_chg': -910.0, 'exchange': 'SHFE', 'variety': 'CU', 'comd': 'cu', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)}, {'date': '2025-08-13', 'symbol': 'CU2508', 'broker': '光大期货', 'vol': 870.0, 'vol_chg': 200.0, 'long_hld': 180.0, 'long_chg': -235.0, 'short_hld': 320.0, 'short_chg': -255.0, 'exchange': 'SHFE', 'variety': 'CU', 'comd': 'cu', 'created_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821265), 'updated_at': datetime.datetime(2025, 8, 14, 18, 28, 54, 821714)}]]
(Background on this error at: https://sqlalche.me/e/20/9h9h)
=========================================================================
2025-08-14 18:29:29 Thu START TASK.01 future_1d future_rank
=========================================================================
2025-08-14 18:29:31,520 - future_1d - INFO - future_rank check=True check_last=7 start...
2025-08-14 18:29:31,604 - future_1d - INFO - future_rank date = 2025-08-06
2025-08-14 18:29:31,757 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='SHFE) done
2025-08-14 18:29:31,857 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='GFEX) done
2025-08-14 18:29:32,017 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='DCE) done
2025-08-14 18:29:32,222 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CZCE) done
2025-08-14 18:29:32,284 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='INE) done
2025-08-14 18:29:32,402 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-06',exchange='CFFEX) done
2025-08-14 18:29:33,097 - future_1d - INFO - save future_rank 2025-08-06 completed
2025-08-14 18:29:41,726 - future_1d - INFO - future_rank date = 2025-08-07
2025-08-14 18:29:41,897 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='SHFE) done
2025-08-14 18:29:42,007 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='GFEX) done
2025-08-14 18:29:42,156 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='DCE) done
2025-08-14 18:29:42,387 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CZCE) done
2025-08-14 18:29:42,453 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='INE) done
2025-08-14 18:29:42,573 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-07',exchange='CFFEX) done
2025-08-14 18:29:43,293 - future_1d - INFO - save future_rank 2025-08-07 completed
2025-08-14 18:29:46,346 - future_1d - INFO - future_rank date = 2025-08-08
2025-08-14 18:29:46,506 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='SHFE) done
2025-08-14 18:29:46,600 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='GFEX) done
2025-08-14 18:29:46,757 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='DCE) done
2025-08-14 18:29:46,975 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CZCE) done
2025-08-14 18:29:47,137 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='INE) done
2025-08-14 18:29:47,288 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-08',exchange='CFFEX) done
2025-08-14 18:29:47,964 - future_1d - INFO - save future_rank 2025-08-08 completed
2025-08-14 18:29:51,514 - future_1d - INFO - future_rank date = 2025-08-11
2025-08-14 18:29:51,671 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='SHFE) done
2025-08-14 18:29:51,774 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='GFEX) done
2025-08-14 18:29:51,854 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='DCE) done
2025-08-14 18:29:52,058 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CZCE) done
2025-08-14 18:29:52,216 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='INE) done
2025-08-14 18:29:52,329 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-11',exchange='CFFEX) done
2025-08-14 18:29:52,914 - future_1d - INFO - save future_rank 2025-08-11 completed
2025-08-14 18:30:00,342 - future_1d - INFO - future_rank date = 2025-08-12
2025-08-14 18:30:00,520 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='SHFE) done
2025-08-14 18:30:00,628 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='GFEX) done
2025-08-14 18:30:00,718 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='DCE) done
2025-08-14 18:30:00,934 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CZCE) done
2025-08-14 18:30:01,027 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='INE) done
2025-08-14 18:30:01,131 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-12',exchange='CFFEX) done
2025-08-14 18:30:01,667 - future_1d - INFO - save future_rank 2025-08-12 completed
2025-08-14 18:30:04,900 - future_1d - INFO - future_rank date = 2025-08-13
2025-08-14 18:30:05,048 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='SHFE) done
2025-08-14 18:30:05,140 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='GFEX) done
2025-08-14 18:30:05,229 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='DCE) done
2025-08-14 18:30:05,432 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CZCE) done
2025-08-14 18:30:05,511 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='INE) done
2025-08-14 18:30:05,618 - future_1d - INFO - pro.fut_holding(trade_date='2025-08-13',exchange='CFFEX) done
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, "Data too long for column 'broker' at row 1")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/project/future_1d/future_rank.py", line 8, in
client.save_future_rank(check=True, check_last=7)
File "/root/project/future_1d/future1d_request.py", line 976, in save_future_rank
data_add.to_sql(tablebase.__tablename__, self.engine, index=False, if_exists='append', chunksize=1000)
File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 333, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pandas/core/generic.py", line 3106, in to_sql
return sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 844, in to_sql
return pandas_sql.to_sql(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 2030, in to_sql
total_inserted = sql_engine.insert_records(
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1579, in insert_records
raise err
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1570, in insert_records
return table.insert(chunksize=chunksize, method=method)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1121, in insert
num_inserted = exec_insert(conn, keys, chunk_iter)
File "/usr/local/lib/python3.10/site-packages/pandas/io/sql.py", line 1012, in _execute_insert
result = conn.execute(self.table.insert(), data)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 526, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1936, in _exec_single_context
self.dialect.do_executemany(
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 196, in do_executemany
rowcount = cursor.executemany(statement, parameters)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 187, in executemany
return self._do_execute_many(
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 225, in _do_execute_many
rows += self.execute(sql + postfix)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
result = self._query(query)
File "/usr/local/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
conn.query(q)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
result.read()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
packet.raise_for_error()
File "/usr/local/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1406, "Data too long for column 'broker' at row 1")
[SQL: INSERT INTO future_rank (date, symbol, broker, vol, vol_chg, long_hld, long_chg, short_hld, short_chg, exchange, variety, comd, created_at, updated_at) VALUES (%(date)s, %(symbol)s, %(broker)s, %(vol)s, %(vol_chg)s, %(long_hld)s, %(long_chg)s, %(short_hld)s, %(short_chg)s, %(exchange)s, %(variety)s, %(comd)s, %(created_at)s, %(updated_at)s)]
[parameters: [{'date': '2025-08-13', 'symbol': 'AD', 'broker': '期货公司会员/境外特殊经纪参与者', 'vol': 4696.0, 'vol_chg': 2504.0, 'long_hld': 10202.0, 'long_chg': 34.0, 'short_hld': 10202.0, 'short_chg': 34.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)}, {'date': '2025-08-13', 'symbol': 'AD', 'broker': '非期货公司会员/境外特殊非经纪参与者', 'vol': 0.0, 'vol_chg': 0.0, 'long_hld': 0.0, 'long_chg': 0.0, 'short_hld': 0.0, 'short_chg': 0.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东亚期货', 'vol': None, 'vol_chg': None, 'long_hld': 148.0, 'long_chg': 3.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东吴期货', 'vol': 86.0, 'vol_chg': 40.0, 'long_hld': None, 'long_chg': None, 'short_hld': 191.0, 'short_chg': 22.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东海期货', 'vol': 151.0, 'vol_chg': 89.0, 'long_hld': 225.0, 'long_chg': 25.0, 'short_hld': None, 'short_chg': None, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '东证期货', 'vol': 138.0, 'vol_chg': 77.0, 'long_hld': 841.0, 'long_chg': -40.0, 'short_hld': 583.0, 'short_chg': -2.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '中信建投', 'vol': 237.0, 'vol_chg': 217.0, 'long_hld': None, 'long_chg': None, 'short_hld': 252.0, 'short_chg': -197.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)}, {'date': '2025-08-13', 'symbol': 'AD2511', 'broker': '中信期货', 'vol': 265.0, 'vol_chg': 143.0, 'long_hld': 761.0, 'long_chg': -7.0, 'short_hld': 656.0, 'short_chg': -4.0, 'exchange': 'SHFE', 'variety': 'AD', 'comd': 'ad', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)} ... displaying 10 of 1000 total bound parameter sets ... {'date': '2025-08-13', 'symbol': 'CU2508', 'broker': '五矿期货', 'vol': 1340.0, 'vol_chg': 165.0, 'long_hld': None, 'long_chg': None, 'short_hld': 1335.0, 'short_chg': -910.0, 'exchange': 'SHFE', 'variety': 'CU', 'comd': 'cu', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)}, {'date': '2025-08-13', 'symbol': 'CU2508', 'broker': '光大期货', 'vol': 870.0, 'vol_chg': 200.0, 'long_hld': 180.0, 'long_chg': -235.0, 'short_hld': 320.0, 'short_chg': -255.0, 'exchange': 'SHFE', 'variety': 'CU', 'comd': 'cu', 'created_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964253), 'updated_at': datetime.datetime(2025, 8, 14, 18, 30, 5, 964706)}]]
(Background on this error at: https://sqlalche.me/e/20/9h9h)