2020-04-08 10:03:59.999999 不调整持仓
2020-04-08 10:04:59.999999 不调整持仓
2020-04-08 10:07:59.999999 不调整持仓
2020-04-08 10:08:59.999999 不调整持仓
2020-04-08 10:09:59.999999 不调整持仓
2020-04-08 10:10:59.999999 不调整持仓
2020-04-08 10:11:59.999999 不调整持仓
2020-04-08 10:13:59.999999 不调整持仓
2020-04-08 10:14:59.999999 高于上轨,目标持仓 多头1手
2020-05-19 17:02:25,891 – INFO – 模拟交易下单 1060ae4de47f72ba689aba4de1c8c71c: 时间:2020-04-08 10:29:59.999999,合约:SHFE.rb2010,开平:CLOSE,方向:BUY,手数:1,价格:3227.0
2020-05-19 17:02:25,893 – INFO – 模拟交易委托单 1060ae4de47f72ba689aba4de1c8c71c: 下单失败, 不在可交易时间段内
Traceback (most recent call last):
File “c:\TQ\DT改良版.py”, line 45, in <module>
api.wait_update()
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 878, in wait_update
self._run_until_idle()
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1532, in _run_until_idle
self._run_once()
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1525, in _run_once
raise self._exceptions.pop(0)
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\lib.py”, line 187, in _target_pos_task
await gather(*[each._task for each in all_tasks])
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\lib.py”, line 267, in _run
raise Exception(“遇到错单: %s %s %s %d手 %f %s” % (
Exception: 遇到错单: SHFE.rb2010 BUY CLOSE 1手 3227.000000 下单失败, 不在可交易时间段内
Task was destroyed but it is pending!
task: <Task pending name=’Task-1′ coro=<TqApi._windows_patch() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py:1559> wait_for=<Future
pending cb=[<TaskWakeupMethWrapper object at 0x000002077A785D00>()]> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-2′ coro=<TqApi._notify_watcher() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py:1567> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000002076DA891C0>()]> cb=[TqApi._on_task_done()]>
Exception ignored in: <coroutine object TqApi._notify_watcher at 0x000002076DE1F840>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1567, in _notify_watcher
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 2326, in __anext__
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\queues.py”, line 165, in get
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1157, in _call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 719, in call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 508, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name=’Task-3′ coro=<TqApi._connect() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py:1629> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x00000207786EF160>()]> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-4′ coro=<TqBacktest._run() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\backtest.py:90> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x0000020779F03970>()]> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-5′ coro=<TqSim._run() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\sim.py:92> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000002077A6D2880>()]> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-6′ coro=<TqWebHelper._run() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\tqwebhelper.py:95> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000002077A6D22E0>()]> cb=[TqApi._on_task_done()]>
Exception ignored in: <coroutine object TqApi._connect at 0x000002076DE1F5C0>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1729, in _connect
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\websockets\client.py”, line 525, in __aexit__
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\websockets\protocol.py”, line 676, in close
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\tasks.py”, line 448, in wait_for
RuntimeError: no running event loop
sys:1: RuntimeWarning: coroutine ‘WebSocketCommonProtocol.write_close_frame’ was never awaited
Task was destroyed but it is pending!
task: <Task pending name=’Task-21′ coro=<TqApi._send_handler() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py:1766> wait_for=<Future
cancelled>>
Exception ignored in: <coroutine object TqBacktest._run at 0x000002076DE1FD40>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\backtest.py”, line 128, in _run
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1157, in _call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 719, in call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 508, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name=’Task-7′ coro=<TqBacktest._md_handler() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\backtest.py:132> wait_for=<Future cancelled>>
2020-05-19 17:02:27,625 – WARNING – 模拟交易成交记录
Exception ignored in: <coroutine object TqSim._run at 0x000002076DD14040>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\sim.py”, line 125, in _run
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\sim.py”, line 160, in _send_stat_report
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\sim.py”, line 553, in _report
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <coroutine object TqWebHelper._run at 0x000002076DD0DF40>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\tqwebhelper.py”, line 128, in _run
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1157, in _call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 719, in call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 508, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name=’Task-9′ coro=<TqWebHelper._data_handler() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\tqwebhelper.py:138> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name=’Task-8′ coro=<TqSim._md_handler() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\sim.py:130> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000002077A7A2190>()]>>
Task was destroyed but it is pending!
task: <Task pending name=’Task-10′ coro=<TqWebHelper.link_httpserver() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\tqwebhelper.py:324> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x0000020770E51400>()]>>
Exception ignored in: <coroutine object TqSim._md_handler at 0x000002076DE568C0>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\sim.py”, line 130, in _md_handler
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 2326, in __anext__
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\queues.py”, line 165, in get
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1157, in _call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 719, in call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 508, in _check_closed
RuntimeError: Event loop is closed
Exception ignored in: <coroutine object TqWebHelper.link_httpserver at 0x000002076DE56B40>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\tqwebhelper.py”, line 327, in link_httpserver
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\aiohttp\web_runner.py”, line 239, in cleanup
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py”, line 722, in get_event_loop_policy
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py”, line 715, 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 pending name=’Task-18′ coro=<WebSocketCommonProtocol.transfer_data() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\websockets\protocol.py:827> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x00000207775E9C40>()]> cb=[<TaskWakeupMethWrapper object at 0x0000020770E85250>()]>
Task was destroyed but it is pending!
task: <Task pending name=’Task-19′ coro=<WebSocketCommonProtocol.keepalive_ping() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\websockets\protocol.py:1119> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x00000207781FE6D0>()]>>
Task was destroyed but it is pending!
task: <Task pending name=’Task-20′ coro=<WebSocketCommonProtocol.close_connection() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\websockets\protocol.py:1169> wait_for=<Task pending name=’Task-18′ coro=<WebSocketCommonProtocol.transfer_data() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\websockets\protocol.py:827> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x00000207775E9C40>()]> cb=[<TaskWakeupMethWrapper object at 0x0000020770E85250>()]>>
Exception ignored in: <coroutine object WebSocketCommonProtocol.close_connection at 0x0000020770E4A6C0>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\websockets\protocol.py”, line 1206, in close_connection
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\websockets\protocol.py”, line 1226, in wait_for_connection_lost
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\tasks.py”, line 448, in wait_for
RuntimeError: no running event loop
Task was destroyed but it is pending!
task: <Task pending name=’Task-39′ coro=<RequestHandler.start() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\aiohttp\web_protocol.py:418> wait_for=<Task pending name=’Task-40′ coro=<Application._handle() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\aiohttp\web_app.py:458> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x0000020779F03310>()]> cb=[<TaskWakeupMethWrapper object at 0x0000020777482E50>()]>>
Task was destroyed but it is pending!
task: <Task pending name=’Task-40′ coro=<Application._handle() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\aiohttp\web_app.py:458> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x0000020779F03310>()]> cb=[<TaskWakeupMethWrapper object at 0x0000020777482E50>()]>
Exception ignored in: <coroutine object RequestHandler.start at 0x000002076DE567C0>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\aiohttp\web_protocol.py”, line 531, in start
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\selector_events.py”, line 690, in close
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1157, in _call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 719, in call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 508, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name=’Task-46′ coro=<TargetPosTask._update_time_from_md() running at C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\lib.py:164> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000002077A7A21F0>()]> cb=[TqApi._on_task_done()]>
Exception ignored in: <coroutine object TargetPosTask._update_time_from_md at 0x0000020770E4A940>
Traceback (most recent call last):
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\lib.py”, line 164, in _update_time_from_md
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 2326, in __anext__
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\queues.py”, line 165, in get
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\site-packages\tqsdk\api.py”, line 1157, in _call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 719, in call_soon
File “C:\Users\DrWan\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py”, line 508, in _check_closed
RuntimeError: Event loop is closed
回测发现如果1节结束前触发条件,用set_target_volume()交易,出错终止,如果实盘会不会也这样出错?
dbsx 已回答的问题 2020年6月17日