1.78K 浏览
0

这是啥?库文件报错吗?

D:\PycharmProjects\pythonProject\.venv\Scripts\python.exe D:\PycharmProjects\pythonProject\Web.py 
在使用天勤量化之前,默认您已经知晓并同意以下免责条款,如果不同意请立即停止使用:https://www.shinnytech.com/blog/disclaimer/
2024-08-06 10:08:57 -     INFO - 您可以访问 http://127.0.0.1:50616 查看策略绘制出的 K 线图形。
2024-08-06 10:08:59 -     INFO - 通知 : 与 wss://free-api.shinnytech.com/t/nfmd/front/mobile 的网络连接已建立
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\Web.py", line 6, in <module>
    klines = api.get_kline_serial("DCE.2409", 10)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\utils.py", line 220, in wrapper
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\api.py", line 733, in get_kline_serial
    if not self.wait_update(deadline=deadline, _task=[task, serial["df"].__dict__["_task"]]):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\api.py", line 1894, in wait_update
    return self._wait_update(deadline=deadline, _task=_task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\api.py", line 1924, in _wait_update
    self._run_until_task_done(task=update_task, deadline=deadline)
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 115, in _run_until_task_done
    self._run_once()
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 84, in _run_once
    raise self._exceptions.pop(0)
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\symbols.py", line 41, in _run
    raise Exception(f"查询合约服务报错 {query_result['error']}")
Exception: 查询合约服务报错 failed to execute graphql operation, errors: [variable instrument_id: [DCE.2409] contains non-existent instrument: DCE.2409]
Task was destroyed but it is pending!
task: <Task pending name='Task-2' coro=<TqApi._notify_watcher() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\api.py:3703> 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-1' coro=<TqBaseApi._windows_patch() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py:146> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Exception ignored in: <coroutine object TqApi._notify_watcher at 0x0000018B91266260>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\api.py", line 3703, in _notify_watcher
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\channel.py", line 143, in __anext__
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\queues.py", line 160, in get
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 77, in _call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 795, in call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 541, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<TqConnect._run() running at D:\PycharmProjects\pythonProject\.venv\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:\PycharmProjects\pythonProject\.venv\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-6' coro=<TqTradingStatus._run() running at D:\PycharmProjects\pythonProject\.venv\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:\PycharmProjects\pythonProject\.venv\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:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\tqwebhelper.py:120> 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:\PycharmProjects\pythonProject\.venv\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 0x0000018B911AF2A0>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\connect.py", line 157, in _run
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\websockets\legacy\client.py", line 637, in __aexit__
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\websockets\legacy\protocol.py", line 769, in close
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\timeouts.py", line 145, in timeout
RuntimeError: no running event loop
Task was destroyed but it is pending!
task: <Task cancelling name='Task-22' coro=<TqConnect._send_handler() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\connect.py:245> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object TqReconnect._run at 0x0000018BABCCA710>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\connect.py", line 324, in _run
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 62, in _cancel_task
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 77, in _call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 795, in call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 541, 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:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\connect.py:327> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object TqTradingStatus._run at 0x0000018B91273AC0>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\trading_status.py", line 26, in _run
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseModule.py", line 47, in _run
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 58, in _cancel_tasks
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 55, in _cancel_tasks
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 62, in _cancel_task
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 77, in _call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 795, in call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 541, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task cancelling name='Task-13' coro=<TqModule._up_handler() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseModule.py:50> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-12' coro=<TqModule._up_handler() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseModule.py:50> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object BaseSim._run at 0x0000018B91273D00>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\tradeable\sim\basesim.py", line 78, in _run
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseModule.py", line 47, in _run
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 55, in _cancel_tasks
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 62, in _cancel_task
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 77, in _call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 795, in call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 541, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task cancelling name='Task-14' coro=<TqModule._up_handler() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseModule.py:50> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object TqWebHelper._run at 0x0000018B90FFE5C0>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\tqwebhelper.py", line 161, in _run
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 58, in _cancel_tasks
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 55, in _cancel_tasks
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 62, in _cancel_task
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 77, in _call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 795, in call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 541, 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() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\tqwebhelper.py:169> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-16' coro=<TqWebHelper.link_httpserver() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\tqwebhelper.py:317> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object TqWebHelper.link_httpserver at 0x0000018B91273E20>
RuntimeError: coroutine ignored GeneratorExit
Exception ignored in: <coroutine object DataExtension._run at 0x0000018B913BC540>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\data_extension.py", line 103, in _run
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 62, in _cancel_task
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 77, in _call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 795, in call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 541, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task cancelling name='Task-17' coro=<DataExtension._md_handler() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\data_extension.py:107> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-19' coro=<WebSocketCommonProtocol.transfer_data() running at D:\PycharmProjects\pythonProject\.venv\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-20' coro=<WebSocketCommonProtocol.keepalive_ping() running at D:\PycharmProjects\pythonProject\.venv\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-21' coro=<WebSocketCommonProtocol.close_connection() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\websockets\legacy\protocol.py:1301> wait_for=<Task pending name='Task-19' coro=<WebSocketCommonProtocol.transfer_data() running at D:\PycharmProjects\pythonProject\.venv\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 0x0000018B91261A40>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\websockets\legacy\protocol.py", line 1337, in close_connection
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\websockets\legacy\protocol.py", line 1355, in close_transport
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\websockets\legacy\protocol.py", line 1379, in wait_for_connection_lost
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\timeouts.py", line 145, in timeout
RuntimeError: no running event loop
Task was destroyed but it is pending!
task: <Task cancelling name='Task-25' coro=<TqApi._fetch_msg() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\api.py:3717> wait_for=<Future cancelled> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name='Task-23' coro=<TqApi._get_serial_async() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\api.py:742> 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-24' coro=<TqDataFrame.async_update() running at D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\objs_not_entity.py:192> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[TqBaseApi._on_task_done()]>
Exception ignored in: <coroutine object TqApi._get_serial_async at 0x0000018B91263ED0>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\api.py", line 742, in _get_serial_async
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\api.py", line 532, in _ensure_symbol_async
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\channel.py", line 143, in __anext__
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\queues.py", line 160, in get
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 77, in _call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 795, in call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 541, in _check_closed
RuntimeError: Event loop is closed
Exception ignored in: <coroutine object TqDataFrame.async_update at 0x0000018B935A1300>
Traceback (most recent call last):
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\objs_not_entity.py", line 192, in async_update
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\channel.py", line 143, in __anext__
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\queues.py", line 160, in get
  File "D:\PycharmProjects\pythonProject\.venv\Lib\site-packages\tqsdk\baseApi.py", line 77, in _call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 795, in call_soon
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 541, in _check_closed
RuntimeError: Event loop is closed
 Process finished with exit code 1

dodin 发表新评论 2024年8月6日

解决了,直接换用tqsdk2