3.85K 浏览
0

Traceback (most recent call last):
File “C:/Users/Administrator/Desktop/PYTHON/期货策略/kd.py”, line 25, in <module>
k_vlaue_hour=get_k_value(cell_content, 60)
File “C:/Users/Administrator/Desktop/PYTHON/期货策略/kd.py”, line 9, in get_k_value
quote = api.get_quote(“KQ.m@”+futures_code) # print(quote.underlying_symbol)
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 405, in get_quote
self._ensure_symbol(symbol)
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 434, in _ensure_symbol
if not self.wait_update(deadline=deadline):
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 1608, in wait_update
raise Exception(f”查询合约服务报错 {query_result[‘error’]}”)
Exception: 查询合约服务报错 failed to execute graphql operation, errors: [instrumentId: KQ.m@DCE.IN dose not exist]
Task was destroyed but it is pending!
task: <Task pending coro=<TqApi._windows_patch() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py:2647> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6BDB2AB88>()]> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending coro=<TqApi._notify_watcher() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py:2655> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6B2F09AF8>()]> cb=[TqApi._on_task_done()]>
Exception ignored in: <coroutine object TqApi._notify_watcher at 0x000001B6B2E90B48>
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 2655, in _notify_watcher
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\channel.py”, line 138, in __anext__
File “C:\ProgramData\Anaconda3\lib\asyncio\queues.py”, line 161, in get
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 2153, in _call_soon
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 683, in call_soon
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 475, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending coro=<TqConnect._run() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\connect.py:84> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6BDC0D258>()]> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending coro=<TqReconnect._run() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\connect.py:142> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6BDBE9318>()]> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending coro=<_run() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\sim.py:105> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6BDB73EE8>()]> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending coro=<TqWebHelper._run() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\tqwebhelper.py:79> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6BDAEFC78>()]> cb=[TqApi._on_task_done()]>
Exception ignored in: <coroutine object TqConnect._run at 0x000001B6B2EC2CC8>
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\connect.py”, line 90, in _run
File “C:\ProgramData\Anaconda3\lib\site-packages\websockets\client.py”, line 525, in __aexit__
File “C:\ProgramData\Anaconda3\lib\site-packages\websockets\protocol.py”, line 679, in close
File “C:\ProgramData\Anaconda3\lib\asyncio\tasks.py”, line 426, in wait_for
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 652, in call_later
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 662, in call_at
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 475, in _check_closed
RuntimeError: Event loop is closed
sys:1: RuntimeWarning: coroutine ‘WebSocketCommonProtocol.write_close_frame’ was never awaited
Task was destroyed but it is pending!
task: <Task pending coro=<TqConnect._send_handler() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\connect.py:121> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object TqReconnect._run at 0x000001B6B2EC2D48>
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\connect.py”, line 185, in _run
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 2153, in _call_soon
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 683, in call_soon
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 475, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending coro=<TqReconnect._send_handler() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\connect.py:189> wait_for=<Future cancelled>>
Exception ignored in: <coroutine object _run at 0x000001B6B2EC2AC8>
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\sim.py”, line 154, in _run
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\sim.py”, line 189, in _send_stat_report
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\sim.py”, line 608, in _report
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 299, in _print
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <coroutine object TqWebHelper._run at 0x000001B6B2EC2DC8>
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\tqwebhelper.py”, line 84, in _run
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 2153, in _call_soon
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 683, in call_soon
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 475, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending coro=<TqWebHelper._data_handler_without_web() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\tqwebhelper.py:158> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending coro=<WebSocketCommonProtocol.transfer_data() running at C:\ProgramData\Anaconda3\lib\site-packages\websockets\protocol.py:827> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6BDB4DDC8>()]> cb=[<TaskWakeupMethWrapper object at 0x000001B6BC04B528>()]>
Task was destroyed but it is pending!
task: <Task pending coro=<WebSocketCommonProtocol.keepalive_ping() running at C:\ProgramData\Anaconda3\lib\site-packages\websockets\protocol.py:1121> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6BD406078>()]>>
Task was destroyed but it is pending!
task: <Task pending coro=<WebSocketCommonProtocol.close_connection() running at C:\ProgramData\Anaconda3\lib\site-packages\websockets\protocol.py:1169> wait_for=<Task pending coro=<WebSocketCommonProtocol.transfer_data() running at C:\ProgramData\Anaconda3\lib\site-packages\websockets\protocol.py:827> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6BDB4DDC8>()]> cb=[<TaskWakeupMethWrapper object at 0x000001B6BC04B528>()]>>
Exception ignored in: <coroutine object WebSocketCommonProtocol.close_connection at 0x000001B6B7CCA8C8>
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site-packages\websockets\protocol.py”, line 1206, in close_connection
File “C:\ProgramData\Anaconda3\lib\site-packages\websockets\protocol.py”, line 1229, in wait_for_connection_lost
File “C:\ProgramData\Anaconda3\lib\asyncio\tasks.py”, line 426, in wait_for
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 652, in call_later
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 662, in call_at
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 475, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending coro=<TqSim._md_handler() running at C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\sim.py:163> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001B6BDB912E8>()]>>
Exception ignored in: <coroutine object TqSim._md_handler at 0x000001B6B2F08B48>
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\sim.py”, line 163, in _md_handler
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\channel.py”, line 138, in __anext__
File “C:\ProgramData\Anaconda3\lib\asyncio\queues.py”, line 161, in get
File “C:\ProgramData\Anaconda3\lib\site-packages\tqsdk\api.py”, line 2153, in _call_soon
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 683, in call_soon
File “C:\ProgramData\Anaconda3\lib\asyncio\base_events.py”, line 475, in _check_closed
RuntimeError: Event loop is closed

dongsinx 已回答的问题 2021年2月4日

求帮助。。。。

0

errors: [instrumentId: KQ.m@DCE.IN dose not exist] 这句话就是指找不到郑商所的IN合约,事实上,郑商所确实也没有IN合约,所以结论是您的【合约代码.xlsx文件】有问题

dongsinx 已回答的问题 2021年2月4日
0

KQ.m@DCE.IN报错有提示,这个你指的是什么合约?

李思恒 已回答的问题 2021年2月2日