2.07K 浏览
0

出现错误提示:

>>> from tqsdk import TqApi, TqAuth, TargetPosTask, TqSim, tafunc
在使用天勤量化之前,默认您已经知晓并同意以下免责条款,如果不同意请立即停止使用:https://www.shinnytech.com/blog/disclaimer/
>>> from tqsdk.account import TqKq
>>> api = TqApi(TqKq(), auth=TqAuth(xxx, xxx))
Traceback (most recent call last):
File “D:\vnstudio\lib\site-packages\urllib3\connectionpool.py”, line 677, in urlopen
chunked=chunked,
File “D:\vnstudio\lib\site-packages\urllib3\connectionpool.py”, line 381, in _make_request
self._validate_conn(conn)
File “D:\vnstudio\lib\site-packages\urllib3\connectionpool.py”, line 978, in _validate_conn
conn.connect()
File “D:\vnstudio\lib\site-packages\urllib3\connection.py”, line 371, in connect
ssl_context=context,
File “D:\vnstudio\lib\site-packages\urllib3\util\ssl_.py”, line 384, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File “D:\vnstudio\lib\ssl.py”, line 412, in wrap_socket
session=session
File “D:\vnstudio\lib\ssl.py”, line 853, in _create
self.do_handshake()
File “D:\vnstudio\lib\ssl.py”, line 1117, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:\vnstudio\lib\site-packages\requests\adapters.py”, line 449, in send
timeout=timeout
File “D:\vnstudio\lib\site-packages\urllib3\connectionpool.py”, line 727, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File “D:\vnstudio\lib\site-packages\urllib3\util\retry.py”, line 403, in increment
raise six.reraise(type(error), error, _stacktrace)
File “D:\vnstudio\lib\site-packages\urllib3\packages\six.py”, line 734, in reraise
raise value.with_traceback(tb)
File “D:\vnstudio\lib\site-packages\urllib3\connectionpool.py”, line 677, in urlopen
chunked=chunked,
File “D:\vnstudio\lib\site-packages\urllib3\connectionpool.py”, line 381, in _make_request
self._validate_conn(conn)
File “D:\vnstudio\lib\site-packages\urllib3\connectionpool.py”, line 978, in _validate_conn
conn.connect()
File “D:\vnstudio\lib\site-packages\urllib3\connection.py”, line 371, in connect
ssl_context=context,
File “D:\vnstudio\lib\site-packages\urllib3\util\ssl_.py”, line 384, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File “D:\vnstudio\lib\ssl.py”, line 412, in wrap_socket
session=session
File “D:\vnstudio\lib\ssl.py”, line 853, in _create
self.do_handshake()
File “D:\vnstudio\lib\ssl.py”, line 1117, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, OSError(0, ‘Error’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
File “D:\vnstudio\lib\site-packages\tqsdk\api.py”, line 281, in __init__
self._setup_connection() # 初始化通讯连接
File “D:\vnstudio\lib\site-packages\tqsdk\api.py”, line 2517, in _setup_connection
quotes = self._fetch_symbol_info(os.getenv(“TQ_INS_URL”, “https://openmd.shinnytech.com/t/md/symbols/2020-09-15.json”))
File “D:\vnstudio\lib\site-packages\tqsdk\api.py”, line 2601, in _fetch_symbol_info
rsp = requests.get(url, headers=self._base_headers, timeout=30)
File “D:\vnstudio\lib\site-packages\requests\api.py”, line 76, in get
return request(‘get’, url, params=params, **kwargs)
File “D:\vnstudio\lib\site-packages\requests\api.py”, line 61, in request
return session.request(method=method, url=url, **kwargs)
File “D:\vnstudio\lib\site-packages\requests\sessions.py”, line 530, in request
resp = self.send(prep, **send_kwargs)
File “D:\vnstudio\lib\site-packages\requests\sessions.py”, line 643, in send
r = adapter.send(request, **kwargs)
File “D:\vnstudio\lib\site-packages\requests\adapters.py”, line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (‘Connection aborted.’, OSError(0, ‘Error’))

makai 已回答的问题 2021年5月21日
0

我也报错了。

chdl21cn 发表新评论 2021年5月21日

看来是服务器的问题,稳定性堪忧啊。。

卸载tqsdk,换了个源再安装就可以了。从豆瓣源换到阿里云。