928 浏览
0

开发工具:vscode

python版本:3.9.19

下面是日志

在使用天勤量化之前,默认您已经知晓并同意以下免责条款,如果不同意请立即停止使用:https://www.shinnytech.com/blog/disclaimer/
Process SpawnProcess-1:
Traceback (most recent call last):
File “D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\api.py”, line 298, in __init__
if not self.wait_update(deadline=deadline): # 等待连接成功并收取截面数据
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\api.py”, line 1879, in wait_update
raise Exception(
Exception: TqSdk 使用了 python3 的原生协程和异步通讯库 asyncio,您所使用的 IDE 不支持 asyncio, 请使用 pycharm 或其它支持 asyncio 的 IDE

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:\ProgramData\anaconda3\Lib\multiprocessing\process.py”, line 314, in _bootstrap
self.run()
File “D:\ProgramData\anaconda3\Lib\multiprocessing\process.py”, line 108, in run
self._target(*self._args, **self._kwargs)
File “D:\ProgramData\anaconda3\Lib\site-packages\uvicorn\_subprocess.py”, line 78, in subprocess_started
target(sockets=sockets)
File “D:\ProgramData\anaconda3\Lib\site-packages\uvicorn\server.py”, line 65, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\ProgramData\anaconda3\Lib\asyncio\runners.py”, line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File “D:\ProgramData\anaconda3\Lib\asyncio\runners.py”, line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\ProgramData\anaconda3\Lib\asyncio\base_events.py”, line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File “D:\ProgramData\anaconda3\Lib\site-packages\uvicorn\server.py”, line 69, in serve
await self._serve(sockets)
File “D:\ProgramData\anaconda3\Lib\site-packages\uvicorn\server.py”, line 76, in _serve
config.load()
File “D:\ProgramData\anaconda3\Lib\site-packages\uvicorn\config.py”, line 433, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\ProgramData\anaconda3\Lib\site-packages\uvicorn\importer.py”, line 19, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\ProgramData\anaconda3\Lib\importlib\__init__.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “<frozen importlib._bootstrap>”, line 1204, in _gcd_import
File “<frozen importlib._bootstrap>”, line 1176, in _find_and_load
File “<frozen importlib._bootstrap>”, line 1147, in _find_and_load_unlocked
File “<frozen importlib._bootstrap>”, line 690, in _load_unlocked
File “<frozen importlib._bootstrap_external>”, line 940, in exec_module
File “<frozen importlib._bootstrap>”, line 241, in _call_with_frames_removed
File “E:\projects\futures_ai\main.py”, line 7, in <module>
api = TqApi(auth=TqAuth(“15XXXXXXX81”, “XXXXXXX”))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\api.py”, line 302, in __init__
self.close()
File “D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\api.py”, line 353, in close
raise Exception(
Exception: TqSdk 使用了 python3 的原生协程和异步通讯库 asyncio,您所使用的 IDE 不支持 asyncio, 请使用 pycharm 或其它支持 asyncio 的 IDE
Task was destroyed but it is pending!
task: <Task pending name=’Task-2′ coro=<TqBaseApi._windows_patch() running at D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\baseApi.py:116> cb=[TqBaseApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-3′ coro=<TqApi._notify_watcher() running at D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\api.py:3677> cb=[TqBaseApi._on_task_done()]>
sys:1: RuntimeWarning: coroutine ‘TqBaseApi._windows_patch’ was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
sys:1: RuntimeWarning: coroutine ‘TqApi._notify_watcher’ was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
sys:1: RuntimeWarning: coroutine ‘TqConnect._run’ was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task was destroyed but it is pending!
task: <Task pending name=’Task-4′ coro=<TqConnect._run() running at D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\connect.py:110> cb=[TqBaseApi._on_task_done()]>
sys:1: RuntimeWarning: coroutine ‘TqReconnect._run’ was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task was destroyed but it is pending!
task: <Task pending name=’Task-5′ coro=<TqReconnect._run() running at D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\connect.py:270> cb=[TqBaseApi._on_task_done()]>
sys:1: RuntimeWarning: coroutine ‘TqSymbols._run’ was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task was destroyed but it is pending!
task: <Task pending name=’Task-6′ coro=<TqSymbols._run() running at D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\symbols.py:15> cb=[TqBaseApi._on_task_done()]>
sys:1: RuntimeWarning: coroutine ‘TqTradingStatus._run’ was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task was destroyed but it is pending!
task: <Task pending name=’Task-7′ coro=<TqTradingStatus._run() running at D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\trading_status.py:16> cb=[TqBaseApi._on_task_done()]>
sys:1: RuntimeWarning: coroutine ‘BaseSim._run’ was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task was destroyed but it is pending!
task: <Task pending name=’Task-8′ coro=<BaseSim._run() running at D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\tradeable\sim\basesim.py:61> cb=[TqBaseApi._on_task_done()]>
sys:1: RuntimeWarning: coroutine ‘TqWebHelper._run’ was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task was destroyed but it is pending!
task: <Task pending name=’Task-9′ coro=<TqWebHelper._run() running at D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\tqwebhelper.py:74> cb=[TqBaseApi._on_task_done()]>
sys:1: RuntimeWarning: coroutine ‘DataExtension._run’ was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task was destroyed but it is pending!
task: <Task pending name=’Task-10′ coro=<DataExtension._run() running at D:\ProgramData\anaconda3\Lib\site-packages\tqsdk\data_extension.py:74> cb=[TqBaseApi._on_task_done()]>

李思恒 已回答的问题 2024年5月20日
0

看看是否用了ipython编写,然后是否编写里有异步,这报错可能是异步报错预想错误之外的错误出现时提示的

李思恒 已回答的问题 2024年5月20日
您正在查看1个答案中的1个,单击此处查看所有答案。