5.46K 浏览
0

更新1.7.0后回测总是报错。提示“不在可交易时间段内”,然后整个程序异常退出!

有很多品种报错,如:jd2005,原 klines = api.get_kline_serial(SYMBOL, 60 * 30 )报错,

改为:klines = api.get_kline_serial(SYMBOL, 60 * 29 )jd2005能过去,不报错。

cu2005 klines = api.get_kline_serial(SYMBOL, 60 * 29 ) 报错,错误信息如下:

INFO – 模拟交易下单 ccaf2792b3d8f6bd936e9cb951d19506: 时间:2019-12-13 10:29:59.999999,合约:SHFE.cu2005,开平:OPEN,方向:BUY,手数:1,价格:49540.0
INFO – 模拟交易委托单 ccaf2792b3d8f6bd936e9cb951d19506: 下单失败, 不在可交易时间段内
Traceback (most recent call last):
File “D:\cu2009.py”, line 105, in <module>
api.wait_update()
File “D:\Python37\lib\site-packages\tqsdk\api.py”, line 878, in wait_update
self._run_until_idle()
File “D:\Python37\lib\site-packages\tqsdk\api.py”, line 1532, in _run_until_idle
self._run_once()
File “D:\Python37\lib\site-packages\tqsdk\api.py”, line 1525, in _run_once
raise self._exceptions.pop(0)
File “D:\Python37\lib\site-packages\tqsdk\lib.py”, line 187, in _target_pos_task
await gather(*[each._task for each in all_tasks])
File “D:\Python37\lib\site-packages\tqsdk\lib.py”, line 268, in _run
self._symbol, self._direction, self._offset, self._volume, limit_price, order.last_msg))
Exception: 遇到错单: SHFE.cu2005 BUY OPEN 1手 49540.000000 下单失败, 不在可交易时间段内
Task was destroyed but it is pending!

aimoons 已回答的问题 2020年5月19日