vnpy_okx icon indicating copy to clipboard operation
vnpy_okx copied to clipboard

OKX websocket订阅在10分钟后不会接收到任何数据

Open KandyYe opened this issue 2 years ago • 5 comments

在连接okex后,订阅ETH-USDT-SWAP行情,10分钟后不会接收到任何数据(账户、行情和订单)。对比币安,可以正常接收到数据。

KandyYe avatar Mar 17 '22 10:03 KandyYe

我一两分钟就要发生这个问题
解决了吗

luster220 avatar Apr 09 '22 02:04 luster220

在vnpy_websocket里面,修改run方法,定时自动重连:

start_time = time.time()
# 持续处理收到的数据
async for msg in self._ws:
    text: str = msg.data
    self._record_last_received_text(text)

    data: dict = self.unpack_data(text)
    self.on_packet(data)

    if time.time() - start_time >= 600:
        break

KandyYe avatar Apr 09 '22 02:04 KandyYe

请问,3.0的版本可以安装吗?有流程吗?

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: Kandy.Ye @.> 发送时间: 2022年4月9日 10:54 收件人: vn-crypto/vnpy_okex @.> 抄送: luster220 @.>, Comment @.> 主题: Re: [vn-crypto/vnpy_okex] OKX websocket订阅在10分钟后不会接收到任何数据 (Issue #18)

在vmpy_websocket里面,修改run方法,定时自动重连: start_time = time.time() # 持续处理收到的数据 async for msg in self._ws: text: str = msg.data self._record_last_received_text(text) data: dict = self.unpack_data(text) self.on_packet(data) if time.time() - start_time >= 600: break
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

luster220 avatar Apr 09 '22 03:04 luster220

3.0版本的可以的,我就是使用的3.0版本。

KandyYe avatar Apr 09 '22 07:04 KandyYe

大神我这个问题你们知道出在哪里了么?

File "/Users/xiaofeiwang/Documents/Quant/vnpy_okex-main/run.py", line 5, in from vnpy_okex import OkexGateway File "/Users/xiaofeiwang/Documents/Quant/vnpy_okex-main/vnpy_okex/init.py", line 25, in from .okex_gateway import OkexGateway File "/Users/xiaofeiwang/Documents/Quant/vnpy_okex-main/vnpy_okex/okex_gateway.py", line 119, in class OkexGateway(BaseGateway): File "/Users/xiaofeiwang/Documents/Quant/vnpy_okex-main/vnpy_okex/okex_gateway.py", line 133, in OkexGateway exchanges: Exchange = [Exchange.OKEX] File "/Users/xiaofeiwang/opt/anaconda3/envs/py37_vnpy/lib/python3.9/enum.py", line 429, in getattr raise AttributeError(name) from None AttributeError: OKEX

ShitcardW avatar Apr 24 '22 13:04 ShitcardW

u need to use this module together: https://github.com/vn-crypto/vnpy_crypto

vn-crypto avatar Jan 27 '23 02:01 vn-crypto