2.63K 浏览
0

前面咨询过这个问题,前期咨询解答链接:https://www.shinnytech.com/question/10612/

开盘下单失败是因为下单太早,根据建议,添加第一笔quote行情中datetime的判断,若确实已经开盘,才发送订单。修改后但晚上开盘下单可以成功了,但上午开盘下单依然失败:

晚上开盘下单成功:
2020-07-20 20:33:11,313 – INFO – 通知: 与 wss://openmd.shinnytech.com/t/md/front/mobile 的网络连接已建立
2020-07-20 20:33:11,316 – INFO – 通知: 与 wss://otg-sim.shinnytech.com/trade 的网络连接已建立
2020-07-20 20:33:11,445 – INFO – 通知: 已经连接到交易前置
2020-07-20 20:33:11,464 – INFO – 通知: 登录成功
*********************** new k: 2020-07-20 21:00:00
is first quote : tm= time.struct_time(tm_year=2020, tm_mon=7, tm_mday=20, tm_hour=21, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=202, tm_isdst=-1)
the quote is in market openning time
new tick : 2020-07-20 21:00:00.504000
send pos change by tick update
2020-07-20 21:00:00,851 – INFO – 通知: 下单成功,合约代码:DCE.i2009,下单方向:买,开平标志:平仓,委托价格:815,委托手数:1
2020-07-20 21:00:00,851 – INFO – 通知: 成交通知,合约代码:DCE.i2009,下单方向:买,开平标志:平仓,成交价格:815,成交手数:1

但早上开盘下单仍然失败:

2020-07-21 08:44:00,548 – INFO – 通知: 与 wss://openmd.shinnytech.com/t/md/front/mobile 的网络连接已建立
2020-07-21 08:44:00,554 – INFO – 通知: 与 wss://otg-sim.shinnytech.com/trade 的网络连接已建立
2020-07-21 08:44:00,706 – INFO – 通知: 已经连接到交易前置
2020-07-21 08:44:00,725 – INFO – 通知: 登录成功
*********************** new k: 2020-07-21 09:00:00
is first quote : tm= time.struct_time(tm_year=2020, tm_mon=7, tm_mday=21, tm_hour=9, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=203, tm_isdst=-1)
the quote is in market openning time
new tick : 2020-07-21 09:00:00.803000
send pos change by tick update
2020-07-21 09:00:00,999 – WARNING – 通知: 下单失败,26:已撤单报单被拒绝DCE:当前状态禁止此项操作,合约代码:DCE.i2009,下单方向:买,开平标志:开仓,委托价格:831,委托手数:1
Traceback (most recent call last):

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: 遇到错单: DCE.i2009 BUY OPEN 1手 831.000000 26:已撤单报单被拒绝DCE:当前状态禁止此项操作

上午10:30下单也失败:

2020-07-21 10:20:00,713 – INFO – 通知: 与 wss://openmd.shinnytech.com/t/md/front/mobile 的网络连接已建立
2020-07-21 10:20:00,716 – INFO – 通知: 与 wss://otg-sim.shinnytech.com/trade 的网络连接已建立
2020-07-21 10:20:00,824 – INFO – 通知: 已经连接到交易前置
2020-07-21 10:20:00,842 – INFO – 通知: 登录成功
*********************** new k: 2020-07-21 10:30:00
new tick : 2020-07-21 10:30:00.805000
send pos change by tick update
2020-07-21 10:30:00,998 – WARNING – 通知: 下单失败,26:已撤单报单被拒绝DCE:当前状态禁止此项操作,合约代码:DCE.i2009,下单方向:买,开平标志:开仓,委托价格:834.5,委托手数:1
Traceback (most recent call last):
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: 遇到错单: DCE.i2009 BUY OPEN 1手 834.500000 26:已撤单报单被拒绝DCE:当前状态禁止此项操作

Harry Xing 问的问题 2020年7月21日