报错为:
2022-12-19 21:24:10.013930 策略交易脚本启动
2022-12-19 21:24:14.682423 触发异常已停止
Traceback (most recent call last):
File "C:\veighna_studio\lib\site-packages\vnpy_scripttrader\engine.py", line 79, in run_strategy
module.run(self)
File "C:\veighna_studio\code\test1.py", line 24, in run
api.wait_update()
File "C:\veighna_studio\lib\site-packages\tqsdk\api.py", line 1872, in wait_update
self._run_until_idle(async_run=False)
File "C:\veighna_studio\lib\site-packages\tqsdk\baseApi.py", line 65, in _run_until_idle
check_handle = self._loop.call_soon(self._check_event, self._event_rev + 1)
File "C:\veighna_studio\lib\site-packages\tqsdk\baseApi.py", line 50, in _call_soon
return org_call_soon(callback, *args, **kargs)
File "C:\veighna_studio\lib\asyncio\base_events.py", line 745, in call_soon
self._check_closed()
File "C:\veighna_studio\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
代码:
api = TqApi(auth=",")
# 设置twap任务参数、
target_twap = Twap(api,"SHFE.fu2305","BUY","OPEN",20,300,1,5)
# 启动循环
while True:
api.wait_update()
if target_twap.is_finished():
break
api.close()
是连simnow的7*24小时环境测试的,请问是因为啥。。。