vn.py量化社区
By Traders, For Traders.
Member
avatar
加入于:
帖子: 34
声望: 0

请教各位大佬,
币安期货binances_gateway 订阅合约tick报错:
Unhandled WebSocket Error:<class 'websocket._exceptions.WebSocketTimeoutException'>
具体如下,请指教:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/socket.py", line 102, in recv
bytes
= _recv()
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_socket.py", line 84, in _recv
return sock.recv(bufsize)
File "/usr/lib/python3.8/ssl.py", line 1226, in recv
return self.read(buflen)
File "/usr/lib/python3.8/ssl.py", line 1101, in read
return self._sslobj.read(len)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./myapi/websocket/websocket_client.py", line 200, in _run
text = ws.recv()
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_core.py", line 314, in recv
opcode, data = self.recv_data()
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_core.py", line 331, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_core.py", line 344, in recv_data_frame
frame = self.recv_frame()
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_core.py", line 378, in recv_frame
return self.frame_buffer.recv_frame()
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_abnf.py", line 361, in recv_frame
self.recv_header()
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_abnf.py", line 309, in recv_header
header = self.recv_strict(2)
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_abnf.py", line 396, in recvstrict
bytes
= self.recv(min(16384, shortage))
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_core.py", line 453, in _recv
return recv(self.sock, bufsize)
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_socket.py", line 105, in recv
raise WebSocketTimeoutException(message)
websocket._exceptions.WebSocketTimeoutException: The read operation timed out
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/socket.py", line 102, in recv
bytes
= _recv()
File "/home/ubuntu/.local/lib/python3.8/site-packages/websocket/_socket.py", line 84, in _recv
return sock.recv(bufsize)
File "/usr/lib/python3.8/ssl.py", line 1226, in recv
return self.read(buflen)
File "/usr/lib/python3.8/ssl.py", line 1101, in read
return self._sslobj.read(len)
socket.timeout: The read operation timed out

Member
avatar
加入于:
帖子: 34
声望: 0

websocket版本如下
Name: websocket
Version: 0.2.1

Member
avatar
加入于:
帖子: 34
声望: 0

binances_gate里面的时区是CHINA_TZ = pytz.timezone("Asia/Shanghai"),如果用境外服务器,是不是要改成服务器所在地的时区呢?
一直搞不懂这个时区的逻辑。。。

Administrator
avatar
加入于:
帖子: 4595
声望: 262

这个报错是典型的网络问题导致SSL超时,请检查下网络连接是否稳定吧

Member
avatar
加入于:
帖子: 34
声望: 0

用Python的交易员 wrote:

这个报错是典型的网络问题导致SSL超时,请检查下网络连接是否稳定吧

网络基本可以肯定是没问题的,用的aws东京节点,而且每次初始化策略订阅合约的时候都会报错。目前来看,并未影响tick推送

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

沪公网安备 31011502017034号