ccxt: Bitfinex RateLimitExceeded - What is the cause of this restriction?
Hello kroitor,
Thank you for your help to all those people in its need.
I seem to be having the same kind of problems but with Bitfinex now. Would your fix apply to any exchange out there?
If it doesn’t then rateLimit doesn’t play a role in my case and here is a print out after using --verbose
Object.assign: bitfinex { “error”: “ERR_RATE_LIMIT”} ccxtService.js:274 constructor:class extends BaseClass { … } message:“bitfinex { “error”: “ERR_RATE_LIMIT”}” name:“RateLimitExceeded” stack:“RateLimitExceeded: bitfinex { “error”: “ERR_RATE_LIMIT”}\n at bitfinex.throwExactlyMatchedException (c:\Users<my private path>\node_modules\ccxt\js\base\Exchange.js:533:19)\n at bitfinex.handleErrors (c:\Users<my private path>\isonex-fund\coin-price-service\node_modules\ccxt\js\bitfinex.js:1172:22)\n at response.text.then (c:\Users<my private path>\node_modules\ccxt\js\base\Exchange.js:628:18)\n at process._tickCallback (internal/process/next_tick.js:68:7)” proto:Object.assign {constructor: }
I hope I am giving you enough information to understand what this is about.
What do you think about the cause of this restriction?
The actual reason is that CCXT does not sign public requests for BitMEX, so it didn’t work for you with the public fetchTicker call. That’s an easy fix though.
Actually, very few exchanges will require authentication (signing) for public requests. And BitMEX fetchTicker is a public endpoint: https://www.bitmex.com/api/v1/instrument/activeAndIndices.
I tried to replicate your error (with public requests unsigned), but in my case it did run for 1 minute or so before breaking down. Looks like their rate limits may vary depending on your location.
Then I tried with signed public calls, and it did work (apparently) – so it continued running without breaking down. Tested it in Python with your snippet and in JS with node examples/js/cli bitmex fetchTicker BTC/USD --poll --verbose (with rateLimit set to 1100).
I’ve uploaded the fix, and it will sign the public requests starting from CCXT 1.18.973 (make sure to update your version), if you supply the apiKey and secret as you do.
Let us know if that does not help. We will be happy if you report back whether it does the trick for you or not. Thx for your involvement!
_Originally posted by @kroitor in https://github.com/ccxt/ccxt/issues/5565#issuecomment-514133560_
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (8 by maintainers)
Commits related to this issue
- exchange.py make rateLimit reconfigurable fix #6467 — committed to ccxt/ccxt by kroitor 4 years ago
Yeah, that worked.
Thanks a million Kroitor.
All the best mate 😃
Thank you Kroitor, I will try the new version and come back if there is a problem.
You’ve been excellent and I think both myself and others can’t thank you enough for your involvement with ccxt and your help. Keep up the good work mate.
Hi Kroitor,
It is confirmed. Setting enableRateLimit and rateLimit after the object’s constructor initialisation does not have the intented effect (i.e. there is no delay between calls and eventually there is a RATE_LIMIT problem).
Maybe something to either mention in the documentation or fix in a future version.
Either way could you let me know what the ccxt team decides to do. 😃
Thank you. You’ve been very helpful. 😃