动态模拟测试中,我订阅了quote行情和1分钟K线行情,在收到quote行情datetime变化时去判断是否已经产生了13:30分开始的K线,如果是,就去set_target_volume下一手买单,结果异常退出。
之前我根据新K线产生下单失败发帖求助,这边的解释是某些常见的K线在开盘前就已经产生了,所以在开盘前下单会失败,建议收到第一笔实时行情后才下单,所以就修改为用实时行情触发下单,结果仍然失败。
*********************** new k: 2020-07-16 13:30:00 (下午的第一根1分钟K线已经产生)
2020-07-16 13:30:01,280 – WARNING – 通知: 下单失败,26:已撤单报单被拒绝CZCE:当前状态禁止此项操作,合约代码:CZCE.SF010,下单方向:买,开平标志:开仓,委托价格:5550,委托手数:1
Traceback (most recent call last):
File “<input>”, line 1, in <module>
File “D:\Program Files\JetBrains\PyCharm Community Edition 2020.1.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py”, line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File “D:\Program Files\JetBrains\PyCharm Community Edition 2020.1.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py”, line 18, in execfile
exec(compile(contents+”\n”, file, ‘exec’), glob, loc)
glb.api.wait_update()
File “E:\05-PycharmDir\venv\lib\site-packages\tqsdk\api.py”, line 877, in wait_update
self._run_until_idle()
File “E:\05-PycharmDir\venv\lib\site-packages\tqsdk\api.py”, line 1531, in _run_until_idle
self._run_once()
File “E:\05-PycharmDir\venv\lib\site-packages\tqsdk\api.py”, line 1524, in _run_once
raise self._exceptions.pop(0)
File “E:\05-PycharmDir\venv\lib\site-packages\tqsdk\lib.py”, line 159, in _target_pos_task
await gather(*[each._task for each in all_tasks])
File “E:\05-PycharmDir\venv\lib\site-packages\tqsdk\lib.py”, line 240, in _run
self._symbol, self._direction, self._offset, self._volume, limit_price, order.last_msg))
Exception: 遇到错单: CZCE.SF010 BUY OPEN 1手 5550.000000 26:已撤单报单被拒绝CZCE:当前状态禁止此项操作