veighna-global / vnpy_okx

OKX trading gateway for VeighNa Evo
MIT License
93 stars 78 forks source link

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

Closed KandyYe closed 1 year ago

KandyYe commented 2 years ago

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

luster220 commented 2 years ago

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

KandyYe commented 2 years ago

在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
luster220 commented 2 years ago

请问,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: @.***>

KandyYe commented 2 years ago

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

ShitcardW commented 2 years ago

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

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

vn-crypto commented 1 year ago

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