I am using Bitfinex WebSockets V2 with Python library https://github.com/Crypto-toolbox/btfxwss. I have a problem with receiving updates when subscribed to many websocket channels. The issue is that I need to subscribe to 3 order book updates, 3 ticker updates, and 3 trades updates (total - 9 channels) at Bitfinex Websocket API. And I just stop receiving updates after like several minutes of normal work with no errors (or keep receiving them, but with huge delay). So can you help me to find out what's wrong ? Are there any limitations for Websocket connections? Because when I subscribe to 1 order book updates using the same code, everything is OK.
Asked
Active
Viewed 163 times
0
-
Can you help us with some more info? – DaveIdito Jul 11 '18 at 14:11
-
No websockets in general shouldn't be affected by that little a number of them. https://stackoverflow.com/questions/15872788/maximum-concurrent-socket-io-connections – DaveIdito Jul 11 '18 at 14:12
-
@DaveIdito i'm connecting like in btfxwss docs: `# order books self.wss.subscribe_to_order_book('SANETH') self.wss.subscribe_to_order_book('SANBTC') self.wss.subscribe_to_order_book('SANUSD') # tickers self.wss.subscribe_to_ticker('ETHUSD') self.wss.subscribe_to_ticker('ETHBTC') self.wss.subscribe_to_ticker('BTCUSD') # trades self.wss.subscribe_to_trades('SANETH') self.wss.subscribe_to_trades('SANBTC') self.wss.subscribe_to_trades('SANUSD')`. where self.wss = BtfxWss() – bohdan.k Jul 11 '18 at 14:23
-
Then I process updates in separate Threads like this: `while True: if not wss_q.empty():` – bohdan.k Jul 11 '18 at 14:27
-
And everything works fine when I'm subscribed to 1 order book + 2 tickers for example. But when I subscribe to more channels, I receive updates with huge delays(I know that by checking order books on website and comparing them to my order books). And my in-memory data is outdated – bohdan.k Jul 11 '18 at 14:29
-
Are you sure it's not because of threading? – DaveIdito Jul 11 '18 at 14:33
-
Well, all threads modify their own variables. So yes, I'm sure. And when I'm running for example 3 threads, there are no issues. – bohdan.k Jul 11 '18 at 14:37