2020-06-10 09:00:00,244 – WARNING – 通知: 下单失败,26:已撤单报单被拒绝CZCE:当前状态禁止此项操作,合约代码:CZCE.SM009,下单方向:卖,开平标志:开仓,委托价格:6472,委托手数:1
Traceback (most recent call last):
File “CZCE.SM2009.py”, line 4, in <module>
strategy_begin(‘CZCE.SM009’)
File “D:\策略交易\XHF\测试策略\策略源码\StrategyStart.py”, line 66, in strategy_begin
main_loop(glb)
File “D:\策略交易\XHF\测试策略\策略源码\MainLoop.py”, line 14, in main_loop
glb.api.wait_update()
File “D:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 878, in wait_update
self._run_until_idle()
File “D:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 1532, in _run_until_idle
self._run_once()
File “D:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 1525, in _run_once
raise self._exceptions.pop(0)
File “D:\ProgramData\Anaconda3\lib\site-packages\tqsdk\lib.py”, line 188, in _target_pos_task
await gather(*[each._task for each in all_tasks])
File “D:\ProgramData\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: 遇到错单: CZCE.SM009 SELL OPEN 1手 6472.000000 26:已撤单报单被拒绝CZCE:当前状态禁止此项操作
Task was destroyed but it is pending!
**********************************
说明:我下单的时机是第一根M15的K线产生后下单,代码如下:
if (api.is_changing(klines.iloc[-1], "datetime")): # 开仓处理
可以通过判断quote的datetime来判断开盘