cryptofeed icon indicating copy to clipboard operation
cryptofeed copied to clipboard

OKX Liquidations bug

Open csxi2A55 opened this issue 3 years ago • 2 comments

Describe the bug Hi there! I've been struggling with an error when trying to subscribe to OKX liquidations. Sorry to bother but I'm fairly new to asyncio so I'm having a hard time debugging on my own - any help would be much appreciated.

(btw - thank you so much for making and sharing this package)

Here's the stack:

2022-04-06 17:11:48,823 : WARNING : OKX.ws.1: encountered connection issue received 1009 (message too big) Max frame length of 65536 has been exceeded.; then sent 1009 (message too big) Max frame length of 65536 has been exceeded. - reconnecting in 1.0 seconds...
Traceback (most recent call last):
  File ".../python3.9/site-packages/cryptofeed/connection_handler.py", line 69, in _create_connection
    await self._handler(connection, self.handler)
  File ".../python3.9/site-packages/cryptofeed/connection_handler.py", line 115, in _handler
    async for message in connection.read():
  File ".../python3.9/site-packages/cryptofeed/connection.py", line 332, in read
    async for data in self.conn:
  File ".../python3.9/site-packages/websockets/legacy/protocol.py", line 481, in __aiter__
    yield await self.recv()
  File ".../python3.9/site-packages/websockets/legacy/protocol.py", line 552, in recv
    await self.ensure_open()
  File ".../python3.9/site-packages/websockets/legacy/protocol.py", line 929, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: received 1009 (message too big) Max frame length of 65536 has been exceeded.; then sent 1009 (message too big) Max frame length of 65536 has been exceeded.

To Reproduce Run the liquidations example filtered down to OKX only.

from cryptofeed import FeedHandler
from cryptofeed.defines import LIQUIDATIONS
from cryptofeed.exchanges import EXCHANGE_MAP

def main():
    f = FeedHandler()
    print("Querying exchange metadata")
    for exchange_string, exchange_class in EXCHANGE_MAP.items():
        if exchange_string in ["OKX"] and LIQUIDATIONS in exchange_class.info()['channels']['websocket']:
            f.add_feed(exchange_class(subscription={LIQUIDATIONS: exchange_class.symbols()}, callbacks={LIQUIDATIONS: liquidations}))
    f.run()

if __name__ == '__main__':
    main()

Expected behavior I'd expect this to work in much the same way the liquidations work for BINANCE_FUTURES, FTX, etc.

Operating System: macOS Monterey

Cryptofeed Version 2.2.1, installed via pip.

csxi2A55 avatar Apr 06 '22 21:04 csxi2A55

I was unable to reproduce this issue. Can you post what version of websockets you are using? @csxi2A55

bmoscon avatar May 22 '22 18:05 bmoscon

I ran into the same issue with OKX L2_ORDERBOOK with all OKX symbols selected.

OS: Ubuntu 22.04 cryptofeed==2.2.3 websockets==10.3

TnzGit avatar Jun 23 '22 01:06 TnzGit

I can't reproduce this issue, so closing

bmoscon avatar Oct 22 '22 21:10 bmoscon