3.57K 浏览
0

我运行网站的示例复盘程序,只是把cu2001改成ni2008,复盘日期从TqApi(backtest=TqReplay(date(2019, 11, 12))改成TqApi(backtest=TqReplay(date(2020, 6, 4)),结果复盘服务器主动拒绝了我的连接请求。请问现在复盘服务不开放了吗?错误信息如下。

https://doc.shinnytech.com/tqsdk/latest/demo/base.html#replay2

F:\Source\tqapi\Trading>python ..\replay2.py
在使用天勤量化之前,默认您已经知晓并同意以下免责条款,如果不同意请立即停止使用:https://www.shinnytech.com/blog/disclaimer/
WARNING – 开始启动复盘服务器,请稍候。
Traceback (most recent call last):
File “E:\Program Files\python365\lib\site-packages\urllib3\connection.py”, line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File “E:\Program Files\python365\lib\site-packages\urllib3\util\connection.py”, line 84, in create_connection
raise err
File “E:\Program Files\python365\lib\site-packages\urllib3\util\connection.py”, line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “E:\Program Files\python365\lib\site-packages\urllib3\connectionpool.py”, line 677, in urlopen
chunked=chunked,
File “E:\Program Files\python365\lib\site-packages\urllib3\connectionpool.py”, line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File “E:\Program Files\python365\lib\http\client.py”, line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File “E:\Program Files\python365\lib\http\client.py”, line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “E:\Program Files\python365\lib\http\client.py”, line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “E:\Program Files\python365\lib\http\client.py”, line 1026, in _send_output
self.send(msg)
File “E:\Program Files\python365\lib\http\client.py”, line 964, in send
self.connect()
File “E:\Program Files\python365\lib\site-packages\urllib3\connection.py”, line 187, in connect
conn = self._new_conn()
File “E:\Program Files\python365\lib\site-packages\urllib3\connection.py”, line 172, in _new_conn
self, “Failed to establish a new connection: %s” % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000021999E92A90>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “E:\Program Files\python365\lib\site-packages\requests\adapters.py”, line 449, in send
timeout=timeout
File “E:\Program Files\python365\lib\site-packages\urllib3\connectionpool.py”, line 725, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File “E:\Program Files\python365\lib\site-packages\urllib3\util\retry.py”, line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=’replay.api.shinnytech.com’, port=80): Max retries exceeded with url: /t/rmd/replay/create_session (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x0000021999E92A90>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it’,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “..\replay2.py”, line 16, in <module>
api = TqApi(backtest=TqReplay(date(2020, 6, 4)), web_gui=”:7999″)
File “E:\Program Files\python365\lib\site-packages\tqsdk\api.py”, line 242, in __init__
self._setup_connection() # 初始化通讯连接
File “E:\Program Files\python365\lib\site-packages\tqsdk\api.py”, line 1166, in _setup_connection
self._ins_url, self._md_url = self._backtest._create_server(self)
File “E:\Program Files\python365\lib\site-packages\tqsdk\backtest.py”, line 468, in _create_server
session = self._prepare_session()
File “E:\Program Files\python365\lib\site-packages\tqsdk\backtest.py”, line 512, in _prepare_session
timeout=5)
File “E:\Program Files\python365\lib\site-packages\requests\api.py”, line 119, in post
return request(‘post’, url, data=data, json=json, **kwargs)
File “E:\Program Files\python365\lib\site-packages\requests\api.py”, line 61, in request
return session.request(method=method, url=url, **kwargs)
File “E:\Program Files\python365\lib\site-packages\requests\sessions.py”, line 530, in request
resp = self.send(prep, **send_kwargs)
File “E:\Program Files\python365\lib\site-packages\requests\sessions.py”, line 643, in send
r = adapter.send(request, **kwargs)
File “E:\Program Files\python365\lib\site-packages\requests\adapters.py”, line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host=’replay.api.shinnytech.com’, port=80): Max retries exceeded with url: /t/rmd/replay/create_session (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x0000021999E92A90>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it’,))
Task was destroyed but it is pending!
task: <Task pending coro=<TqApi._notify_watcher() running at E:\Program Files\python365\lib\site-packages\tqsdk\api.py:1561> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending coro=<TqApi._windows_patch() running at E:\Program Files\python365\lib\site-packages\tqsdk\api.py:1556> cb=[TqApi._on_task_done()]>
sys:1: RuntimeWarning: coroutine ‘TqApi._notify_watcher’ was never awaited
sys:1: RuntimeWarning: coroutine ‘TqApi._windows_patch’ was never awaited

ringo 已回答的问题 2020年6月8日