Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some notes #1

Open
STRML opened this issue Nov 5, 2016 · 3 comments
Open

Some notes #1

STRML opened this issue Nov 5, 2016 · 3 comments

Comments

@STRML
Copy link

STRML commented Nov 5, 2016

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!

@askmike
Copy link
Owner

askmike commented Dec 25, 2018

@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

@STRML
Copy link
Author

STRML commented Dec 26, 2018

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.

@askmike
Copy link
Owner

askmike commented Jan 13, 2019

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.

@github-staff github-staff deleted a comment from akashakki Apr 29, 2024
@github-staff github-staff deleted a comment from akashakki Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@askmike @STRML and others