bmoscon / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
2.22k stars 684 forks source link

HTTP Errors 525 and 526 on both local machine and VPS #525

Closed rodenwild closed 3 years ago

rodenwild commented 3 years ago

Describe the bug Starting up the websocked feed gives the following error.

2021-06-16 19:52:42,624 : WARNING : FTX.ws.1: encountered connection issue server rejected WebSocket connection: HTTP 525 - reconnecting in 2.0 seconds...
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/cryptofeed/connection_handler.py", line 55, in _create_connection
    async with self.conn.connect() as connection:
  File "/usr/lib/python3.9/contextlib.py", line 175, in __aenter__
    return await self.gen.__anext__()
  File "/usr/local/lib/python3.9/dist-packages/cryptofeed/connection.py", line 76, in connect
    await self._open()
  File "/usr/local/lib/python3.9/dist-packages/cryptofeed/connection.py", line 202, in _open
    self.conn = await websockets.connect(self.address, **self.ws_kwargs)
  File "/usr/local/lib/python3.9/dist-packages/websockets/legacy/client.py", line 629, in __await_impl__
    await protocol.handshake(
  File "/usr/local/lib/python3.9/dist-packages/websockets/legacy/client.py", line 388, in handshake
    raise InvalidStatusCode(status_code)
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 525

Also

2021-06-17 07:48:41,133 : WARNING : FTX.ws.1: encountered connection issue server rejected WebSocket connection: HTTP 526 - reconnecting in 1.0 seconds...
Traceback (most recent call last):
  File "/Users/venv/lib/python3.9/site-packages/cryptofeed/connection_handler.py", line 55, in _create_connection
    async with self.conn.connect() as connection:
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 175, in __aenter__
    return await self.gen.__anext__()
  File "/Users/venv/lib/python3.9/site-packages/cryptofeed/connection.py", line 76, in connect
    await self._open()
  File "/Users/venv/lib/python3.9/site-packages/cryptofeed/connection.py", line 202, in _open
    self.conn = await websockets.connect(self.address, **self.ws_kwargs)
  File "/Users/venv/lib/python3.9/site-packages/websockets/legacy/client.py", line 629, in __await_impl__
    await protocol.handshake(
  File "/Users/venv/lib/python3.9/site-packages/websockets/legacy/client.py", line 388, in handshake
    raise InvalidStatusCode(status_code)
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 526
2021-06-17 07:48:42,206 : WARNING : FTX.ws.1: Rate Limited - waiting 60 seconds to reconnect

To Reproduce Can be reproduced with the following code

from cryptofeed import FeedHandler
from cryptofeed.callback import LiquidationCallback
from cryptofeed.defines import LIQUIDATIONS
from cryptofeed.exchanges import FTX

async def liquidations(feed, symbol, side, leaves_qty, price, order_id, status, timestamp):
    print(symbol)

def main():
    f = FeedHandler()
    f.add_feed(FTX(symbols=FTX.info()['symbols'], channels=[LIQUIDATIONS],
                   callbacks={LIQUIDATIONS: LiquidationCallback(liquidations)}))

    f.run()

if __name__ == '__main__':
    main()

Operating System:

Cryptofeed Version

bmoscon commented 3 years ago

looks like a problem on the FTX side - I can't even access their website - it has an SSL error:

https://docs.ftx.com/

bmoscon commented 3 years ago

the issue looks to have been resolved now