vn.py官网
开源量化社区
Member
avatar
加入于:
帖子: 62
声望: 3

经常出现如下错误,而且关闭错误提示窗口以后整个系统就退出了,这就吐血了。。。

我用的是linux环境,最新的vnpy版本(2.1.9.**)


[2021-03-17T23:59:22.657604]: Unhandled RestClient Error:<class 'requests.exceptions.ConnectionError'>
request:request : POST /fapi/v1/order?newClientOrderId=328hhn6c-210317234646000001&price=58960.52&quantity=0.001&side=BUY&symbol=BTCUSDT&timeInForce=GTC&timestamp=1616025562656&type=LIMIT&signature=8****da0db33f357f1106************5e*****6g error because terminated: 
headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json', 'X-MBX-APIKEY': '2dwB**************************r7T'}
params: {}
data: {}
response:

Exception trace: 
Traceback (most recent call last):
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 1369, in getresponse
    response.begin()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 310, in begin
    version, status, reason = self._read_status()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 271, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/home/vnpy/miniconda3/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/home/vnpy/miniconda3/lib/python3.7/ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "/home/vnpy/miniconda3/lib/python3.7/ssl.py", line 929, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 727, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/util/retry.py", line 410, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 1369, in getresponse
    response.begin()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 310, in begin
    version, status, reason = self._read_status()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 271, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/home/vnpy/miniconda3/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/home/vnpy/miniconda3/lib/python3.7/ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "/home/vnpy/miniconda3/lib/python3.7/ssl.py", line 929, in read
    return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/vnpy/api/rest/rest_client.py", line 262, in _process_request
    proxies=self.proxies,
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
Traceback (most recent call last):
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 1369, in getresponse
    response.begin()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 310, in begin
    version, status, reason = self._read_status()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 271, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/home/vnpy/miniconda3/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/home/vnpy/miniconda3/lib/python3.7/ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "/home/vnpy/miniconda3/lib/python3.7/ssl.py", line 929, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 727, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/util/retry.py", line 410, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 1369, in getresponse
    response.begin()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 310, in begin
    version, status, reason = self._read_status()
  File "/home/vnpy/miniconda3/lib/python3.7/http/client.py", line 271, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/home/vnpy/miniconda3/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/home/vnpy/miniconda3/lib/python3.7/ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "/home/vnpy/miniconda3/lib/python3.7/ssl.py", line 929, in read
    return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/vnpy/api/rest/rest_client.py", line 262, in _process_request
    proxies=self.proxies,
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/home/vnpy/miniconda3/lib/python3.7/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
QObject::setParent: Cannot set parent, new parent is in a different thread
QObject::startTimer: Timers cannot be started from another thread
Segmentation fault (core dumped)

大家有没有什么改进的方向?

Administrator
avatar
加入于:
帖子: 4881
声望: 284

币安服务器更新后,会定时关闭长连接导致的,下个版本会修复

Member
avatar
加入于:
帖子: 62
声望: 3

用Python的交易员 wrote:

币安服务器更新后,会定时关闭长连接导致的,下个版本会修复
有没有quick & dirty 的修复方法或workaround,比如我每天停止一下策略,再启动?

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3

沪公网安备 31011502017034号