Open STRML opened 8 years ago
@STRML
Hey Sam,
I never got back to this I see, well better late than never :-)
I never continued this lib, until my market maker got burned yesterday after too quickly retrying API calls during overload and getting my server's IP banned. I want to properly retry and backoff based on the rate limit quotas Bitmex replies with. In order to do that I need a lib that easily exposes them, which will be this lib.
I just pushed a new initial version (here) based on the sample connector code.
Regards, Mike
Great. The default rate limit for authenticated users is 300/5min (1 per second) using a token bucket ratelimiter. If you have multiple processes using the same account, ratelimit failures are tricky to deal with, otherwise they are quite easy.
See https://github.com/BitMEX/sample-market-maker/blob/master/market_maker/bitmex.py#L288 for an example. Retry-After
and X-RateLimit-Reset
convey the same information, the former being relative and the latter being absolute.
Merry Christmas.
If you have multiple processes using the same account, ratelimit failures are tricky to deal with, otherwise they are quite easy.
This was definitely related to my problem: inside my trader I had bucketing which didn't take API usage of an external monitoring script into account.
From now on I will be using this lib and relying on the headers BitMEX sends me. I've also added some optimizations in this lib such as adding keep-alive & disabling Nagle's algorithm (also fixed BitMEX/api-connectors#308).
Merry Christmas.
Happy days too and thanks a lot for BitMEX! If our paths ever cross I'd love to buy you a beer.
Hey, Sam here, CTO of BitMEX.
You can save a lot of time by starting with something like https://github.com/BitMEX/api-connectors/tree/master/official/node-swagger, where we've already written the API Key auth part and you can use the Swagger spec (which generates the documentation page) to autogenerate API methods.
Best of luck!