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

Rate Limiter / Out of frequency limit #110

Open
nikkozp opened this issue Feb 17, 2023 · 0 comments
Open

Rate Limiter / Out of frequency limit #110

nikkozp opened this issue Feb 17, 2023 · 0 comments

Comments

@nikkozp
Copy link

nikkozp commented Feb 17, 2023

Hi
I have a problem, my requests run into limits and the error "Out of frequency limit". I have a lot of coins in which I need to change the price, but there are so many of them that requests will always run into limits.

Limits can be viewed here.

I use this solution in the code. Orders are queued, but still, over time, a limit error appears.

clientOption.UsdPerpetualApiOptions.RateLimitingBehaviour = RateLimitingBehaviour.Wait;
clientOption.UsdPerpetualApiOptions.RateLimiters = new List<IRateLimiter>
{
       new RateLimiter()
               .AddEndpointLimit(new [] { "/public/linear", "/private/linear" }, 100, TimeSpan.FromMinutes(1))

               .AddEndpointLimit(new [] { "/public/linear", "/private/linear" }, 50, TimeSpan.FromSeconds(1), HttpMethod.Get)
               .AddEndpointLimit(new [] { "/public/linear", "/private/linear" }, 50 * 120, TimeSpan.FromSeconds(120), HttpMethod.Get)
               .AddEndpointLimit(new [] { "/public/linear", "/private/linear" }, 70, TimeSpan.FromSeconds(1), HttpMethod.Get)
               .AddEndpointLimit(new [] { "/public/linear", "/private/linear" }, 70 * 5, TimeSpan.FromSeconds(5), HttpMethod.Get)

               .AddEndpointLimit(new [] { "/public/linear", "/private/linear" }, 20, TimeSpan.FromSeconds(1), HttpMethod.Post)
               .AddEndpointLimit(new [] { "/public/linear", "/private/linear" }, 20 * 120, TimeSpan.FromSeconds(120), HttpMethod.Post)
               .AddEndpointLimit(new [] { "/public/linear", "/private/linear" }, 50, TimeSpan.FromSeconds(1), HttpMethod.Post)
               .AddEndpointLimit(new [] { "/public/linear", "/private/linear" }, 50 * 5, TimeSpan.FromSeconds(5), HttpMethod.Post),
};

Am I specifying the limits correctly?

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

1 participant