INFO – 模拟交易下单 6866ddfea6b97f10288c3ffd50014432: 时间:2019-12-24 10:29:59.999999,合约:SHFE.hc2005,开平:OPEN,方向:BUY,手数:2,价格:3547.0
INFO – 模拟交易委托单 6866ddfea6b97f10288c3ffd50014432: 下单失败, 不在可交易时间段内
Traceback (most recent call last):
File “E:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py”, line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “<ipython-input-2-bb69fcb3050c>”, line 1, in <module>
runfile(‘E:/TQ_final/sques__pattern_pair.py’, wdir=’E:/TQ_final’)
File “E:\PyCharm Community Edition 2019.2.2\helpers\pydev\_pydev_bundle\pydev_umd.py”, line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File “E:\PyCharm Community Edition 2019.2.2\helpers\pydev\_pydev_imps\_pydev_execfile.py”, line 18, in execfile
exec(compile(contents+”\n”, file, ‘exec’), glob, loc)
File “E:/TQ_final/sques__pattern_pair.py”, line 1213, in <module>
api.wait_update()
File “E:\Anaconda3\lib\site-packages\tqsdk\api.py”, line 878, in wait_update
self._run_until_idle()
File “E:\Anaconda3\lib\site-packages\tqsdk\api.py”, line 1532, in _run_until_idle
self._run_once()
File “E:\Anaconda3\lib\site-packages\tqsdk\api.py”, line 1525, in _run_once
raise self._exceptions.pop(0)
File “E:\Anaconda3\lib\site-packages\tqsdk\lib.py”, line 188, in _target_pos_task
await gather(*[each._task for each in all_tasks])
File “E:\Anaconda3\lib\site-packages\tqsdk\lib.py”, line 269, in _run
self._symbol, self._direction, self._offset, self._volume, limit_price, order.last_msg))
Exception: 遇到错单: SHFE.hc2005 BUY OPEN 2手 3547.000000 下单失败, 不在可交易时间段内
加了交易时段判断后问题解决了
这个错是更新版本后才出的,是不是之前的版本在有下单的情况下会自动在下一个可交易时段下单,而更新了以后需要提前判断一下可交易时段即可?