复盘这几天无法使用, 一直被拒绝连接,看到有人提出这个问题,我这报错还是使用的人多吗?
WARNING - 开始启动复盘服务器,请稍候。
---------------------------------------------------------------------------
ConnectionRefusedError Traceback (most recent call last)
/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
158 conn = connection.create_connection(
--> 159 (self._dns_host, self.port), self.timeout, **extra_kw)
160
/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
79 if err is not None:
---> 80 raise err
81
/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
69 sock.bind(source_address)
---> 70 sock.connect(sa)
71 return sock
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
NewConnectionError Traceback (most recent call last)
/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
599 body=body, headers=headers,
--> 600 chunked=chunked)
601
/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
353 else:
--> 354 conn.request(method, url, **httplib_request_kw)
355
/usr/local/anaconda3/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)
1228 """Send a complete request to the server."""
-> 1229 self._send_request(method, url, body, headers, encode_chunked)
1230
/usr/local/anaconda3/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
1274 body = _encode(body, 'body')
-> 1275 self.endheaders(body, encode_chunked=encode_chunked)
1276
/usr/local/anaconda3/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)
1223 raise CannotSendHeader()
-> 1224 self._send_output(message_body, encode_chunked=encode_chunked)
1225
/usr/local/anaconda3/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)
1015 del self._buffer[:]
-> 1016 self.send(msg)
1017
/usr/local/anaconda3/lib/python3.7/http/client.py in send(self, data)
955 if self.auto_open:
--> 956 self.connect()
957 else:
/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/connection.py in connect(self)
180 def connect(self):
--> 181 conn = self._new_conn()
182 self._prepare_conn(conn)
/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
167 raise NewConnectionError(
--> 168 self, "Failed to establish a new connection: %s" % e)
169
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x11421fa90>: Failed to establish a new connection: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
/usr/local/anaconda3/lib/python3.7/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
448 retries=self.max_retries,
--> 449 timeout=timeout
450 )
/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
637 retries = retries.increment(method, url, error=e, _pool=self,
--> 638 _stacktrace=sys.exc_info()[2])
639 retries.sleep()
/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
398 if new_retry.is_exhausted():
--> 399 raise MaxRetryError(_pool, url, error or ResponseError(cause))
400
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 0x11421fa90>: Failed to establish a new connection: [Errno 61] Connection refused'))
During handling of the above exception, another exception occurred:
ConnectionError Traceback (most recent call last)
<ipython-input-3-917ec61be638> in <module>
----> 1 api = TqApi(acc, backtest = TqReplay(date(2020, 3, 20)))
/usr/local/anaconda3/lib/python3.7/site-packages/tqsdk/api.py in __init__(self, account, auth, url, backtest, web_gui, debug, loop, _ins_url, _md_url, _td_url)
238 self.create_task(self._windows_patch()) # Windows系统下asyncio不支持KeyboardInterrupt的临时补丁
239 self.create_task(self._notify_watcher()) # 监控服务器发送的通知
--> 240 self._setup_connection() # 初始化通讯连接
241
242 # 等待初始化完成
/usr/local/anaconda3/lib/python3.7/site-packages/tqsdk/api.py in _setup_connection(self)
1163 if isinstance(self._backtest, TqReplay):
1164 self._account = self._account if isinstance(self._account, TqSim) else TqSim()
-> 1165 self._ins_url, self._md_url = self._backtest._create_server(self)
1166
1167 # 连接合约和行情服务器
/usr/local/anaconda3/lib/python3.7/site-packages/tqsdk/backtest.py in _create_server(self, api)
464 self._logger.warning('开始启动复盘服务器,请稍候。')
465
--> 466 session = self._prepare_session()
467 self._session_url = "http://%s:%d/t/rmd/replay/session/%s" % (session["ip"], session["session_port"], session["session"])
468 self._ins_url = "http://%s:%d/t/rmd/replay/session/%s/symbol" % (session["ip"], session["session_port"], session["session"])
/usr/local/anaconda3/lib/python3.7/site-packages/tqsdk/backtest.py in _prepare_session(self)
505 headers=self._api._base_headers,
506 data=json.dumps({'dt': self._replay_dt.strftime("%Y%m%d")}),
--> 507 timeout=5)
508 if response.status_code == 200:
509 return json.loads(response.content)
/usr/local/anaconda3/lib/python3.7/site-packages/requests/api.py in post(url, data, json, **kwargs)
114 """
115
--> 116 return request('post', url, data=data, json=json, **kwargs)
117
118
/usr/local/anaconda3/lib/python3.7/site-packages/requests/api.py in request(method, url, **kwargs)
58 # cases, and look like a memory leak in others.
59 with sessions.Session() as session:
---> 60 return session.request(method=method, url=url, **kwargs)
61
62
/usr/local/anaconda3/lib/python3.7/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
531 }
532 send_kwargs.update(settings)
--> 533 resp = self.send(prep, **send_kwargs)
534
535 return resp
/usr/local/anaconda3/lib/python3.7/site-packages/requests/sessions.py in send(self, request, **kwargs)
644
645 # Send the request
--> 646 r = adapter.send(request, **kwargs)
647
648 # Total elapsed time of the request (approximately)
/usr/local/anaconda3/lib/python3.7/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
514 raise SSLError(e, request=request)
515
--> 516 raise ConnectionError(e, request=request)
517
518 except ClosedPoolError as e:
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 0x11421fa90>: Failed to establish a new connection: [Errno 61] Connection refused'))
ringo 已回答的问题 2020年3月23日