bitfinexcom / bitfinex-api-node

BITFINEX NodeJS trading API - Bitcoin, Litecoin, and Ether exchange
https://www.bitfinex.com/
MIT License
462 stars 213 forks source link

websocket API "subscribe: limit" error #488

Open gabrieldodan opened 5 years ago

gabrieldodan commented 5 years ago

Issue type

Hi all,

I am getting "subscribe: limit" when subscribing to trades and orderbook channels. Anybody else has this issue?

Regards!

electic commented 5 years ago

Version 2.0.7 has a fix for the manager's upper subscribe limit. Version 2.0.6 has an uper limit of 250 which is wrong. The correct value is 30.

However, 2.0.7 has not been pushed to npm. You will have to change your package.json file to point to this repository:

"bitfinex-api-node": "git+https://github.com/bitfinexcom/bitfinex-api-node.git",

gabrieldodan commented 5 years ago

I see, thank you @electic !

mmorasch commented 5 years ago

Hey there! As I am doing my own implementation I noticed that the upper limit was changed to 30. After changing it so that each WebSocket has 30 subscriptions and having the server having multiple WebSockets, I now get a WebSocket error event with

Unexpected server response: 429

Which means too many requests.. is there now a limit to the request amount itself? What should be the time between requests?

Regards

electic commented 5 years ago

@mmorasch Are you using the repo version as in my previous message? Also, are you using the manager?

mmorasch commented 5 years ago

@electic I'm trying to build my own websocket implementation of the bitfinex ws API.. but I can't figure out the rate limit, as I do not find anything regarding that issue in the official documentations for websockets except a limit of 30 channels per websocket, but still get the 429 error response

did you come across a similar issue? or does it not apply to the bitfinex-api-node manager?

electic commented 5 years ago

@mmorasch there might be a rate limit per connection. So if you burst 30 subscribes all at once, it might throw an error. Without seeing your code it is hard to say. To figure that out, you would have to dig through the code of the manager on this repo and the underlying ws2 socket implementation.

Why not use the manager? Not sure why you are re-inventing the wheel here.