601 浏览
0

D:\Programs\Python\Python311\python.exe D:\Learning\program_py\TqSdk_2023_12\demo.py
在使用天勤量化之前,默认您已经知晓并同意以下免责条款,如果不同意请立即停止使用:https://www.shinnytech.com/blog/disclaimer/
Task was destroyed but it is pending!
task: <Task pending name=’Task-1′ coro=<TqBaseApi._windows_patch() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseApi.py:119> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-2′ coro=<TqApi._notify_watcher() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\api.py:3625> wait_for=<Future finished result=None> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-3′ coro=<TqConnect._run() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\connect.py:190> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-4′ coro=<TqReconnect._run() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\connect.py:274> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-5′ coro=<TqSymbols._run() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\symbols.py:29> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-6′ coro=<TqTradingStatus._run() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\trading_status.py:26> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-7′ coro=<BaseSim._run() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\tradeable\sim\basesim.py:78> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-8′ coro=<TqWebHelper._run() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\tqwebhelper.py:80> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-9′ coro=<DataExtension._run() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\data_extension.py:85> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Exception ignored in: <coroutine object TqConnect._run at 0x000001E70D2F6DC0>
Traceback (most recent call last):
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\connect.py”, line 157, in _run
File “D:\Programs\Python\Python311\Lib\site-packages\websockets\legacy\client.py”, line 637, in __aexit__
File “D:\Programs\Python\Python311\Lib\site-packages\websockets\legacy\protocol.py”, line 769, in close
File “D:\Programs\Python\Python311\Lib\asyncio\timeouts.py”, line 141, in timeout
RuntimeError: no running event loop
Task was destroyed but it is pending!
task: <Task cancelling name=’Task-21′ coro=<TqConnect._send_handler() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\connect.py:245> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object TqReconnect._run at 0x000001E759DC4320>
Traceback (most recent call last):
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\connect.py”, line 324, in _run
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseApi.py”, line 50, in _call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 761, in call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 519, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task cancelling name=’Task-10′ coro=<TqReconnect._send_handler() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\connect.py:328> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object TqSymbols._run at 0x000001E70D337290>
Traceback (most recent call last):
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\symbols.py”, line 63, in _run
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseApi.py”, line 50, in _call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 761, in call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 519, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task cancelling name=’Task-11′ coro=<TqSymbols._sim_handler() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\symbols.py:68> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object TqTradingStatus._run at 0x000001E759E28760>
Traceback (most recent call last):
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\trading_status.py”, line 26, in _run
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseModule.py”, line 47, in _run
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseModule.py”, line 47, in <listcomp>
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseApi.py”, line 50, in _call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 761, in call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 519, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task cancelling name=’Task-12′ coro=<TqModule._up_handler() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseModule.py:51> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object BaseSim._run at 0x000001E759DE8940>
Traceback (most recent call last):
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\tradeable\sim\basesim.py”, line 83, in _run
File “D:\Programs\Python\Python311\Lib\asyncio\tasks.py”, line 749, in gather
File “D:\Programs\Python\Python311\Lib\asyncio\events.py”, line 761, in get_event_loop_policy
File “D:\Programs\Python\Python311\Lib\asyncio\events.py”, line 754, in _init_event_loop_policy
ImportError: sys.meta_path is None, Python is likely shutting down
Task was destroyed but it is pending!
task: <Task cancelling name=’Task-14′ coro=<TqModule._up_handler() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseModule.py:51> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object TqWebHelper._run at 0x000001E70D289170>
Traceback (most recent call last):
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\tqwebhelper.py”, line 85, in _run
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseApi.py”, line 50, in _call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 761, in call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 519, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task cancelling name=’Task-15′ coro=<TqWebHelper._data_handler_without_web() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\tqwebhelper.py:168> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object DataExtension._run at 0x000001E70D574F20>
Traceback (most recent call last):
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\data_extension.py”, line 103, in _run
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseApi.py”, line 50, in _call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 761, in call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 519, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task cancelling name=’Task-16′ coro=<DataExtension._md_handler() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\data_extension.py:107> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name=’Task-13′ coro=<TqModule._up_handler() running at D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseModule.py:51> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Exception ignored in: <coroutine object TqModule._up_handler at 0x000001E70FF45990>
Traceback (most recent call last):
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseModule.py”, line 51, in _up_handler
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\channel.py”, line 143, in __anext__
File “D:\Programs\Python\Python311\Lib\asyncio\queues.py”, line 160, in get
File “D:\Programs\Python\Python311\Lib\site-packages\tqsdk\baseApi.py”, line 50, in _call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 761, in call_soon
File “D:\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 519, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name=’Task-18′ coro=<WebSocketCommonProtocol.transfer_data() running at D:\Programs\Python\Python311\Lib\site-packages\websockets\legacy\protocol.py:963> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[Task.task_wakeup()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-19′ coro=<WebSocketCommonProtocol.keepalive_ping() running at D:\Programs\Python\Python311\Lib\site-packages\websockets\legacy\protocol.py:1254> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name=’Task-20′ coro=<WebSocketCommonProtocol.close_connection() running at D:\Programs\Python\Python311\Lib\site-packages\websockets\legacy\protocol.py:1301> wait_for=<Task pending name=’Task-18′ coro=<WebSocketCommonProtocol.transfer_data() running at D:\Programs\Python\Python311\Lib\site-packages\websockets\legacy\protocol.py:963> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[Task.task_wakeup()]>>
Exception ignored in: <coroutine object WebSocketCommonProtocol.close_connection at 0x000001E70D36C930>
Traceback (most recent call last):
File “D:\Programs\Python\Python311\Lib\site-packages\websockets\legacy\protocol.py”, line 1337, in close_connection
File “D:\Programs\Python\Python311\Lib\site-packages\websockets\legacy\protocol.py”, line 1355, in close_transport
File “D:\Programs\Python\Python311\Lib\site-packages\websockets\legacy\protocol.py”, line 1379, in wait_for_connection_lost
File “D:\Programs\Python\Python311\Lib\asyncio\timeouts.py”, line 141, in timeout
RuntimeError: no running event loop

进程已结束,退出代码为 0

snowfeng2019 未选择答案 2023年12月15日
0

没什么大问题,就是你调用完api后没有关闭,可以顺着文档过一下前面的,在你不用的时候调用api.close()

snowfeng2019 发表新评论 2023年12月15日