Need Help! Rate limiting on Advanced Trade API

I am consistently having an issue navigating the rate limiting on the Advanced Trade API. There’s not a lot of documentation on the rate limiting of the Advanced Trade API, so I’m looking for some assistance in finding some answers to the following questions:

  • How do I determine if an endpoint is public or private for determining official rate limit?
  • Does each unique endpoint have its own limit, or are limits shared across endpoints? If shared, how?
  • Does the limiter use a rolling or fixed window to calculate available tokens?
    • i.e. If I make 30 requests at 1:00:00.505, can I make another 30 requests at 1:00:01.000, or must I wait at least a second until 1:00:01.505?
  • When I make a request, does the token replenish 1 second after the start or end of the API call?
    • i.e. If I make a request at 1:00:00.505 but it doesn’t finish until 1:00:00.809, must I wait until 1:00:01.505 or 1:00:01.809 to make another request using that limit token?
  • This article states that “users may see increased throttling while we experience increased trade volume”. I do not believe this was a concern on the Pro API - Short of infinitely retrying my requests, how do I determine the new rate limit so that my trading is not adversely affected?
  • For when I am throttled dynamically: If I place a call to an endpoint and receive a 429 Too Many Requests in response, does this failed request count towards my limit or is it ignored?

Issue Context

I am frequently rejected on the following endpoints:

  • /api/v3/brokerage/orders
  • /api/v3/brokerage/orders/historical/{orderId}
  • /api/v3/brokerage/products/{productId}/candles

Based on this article, my implementation calculates api token allowance by:

  1. Rate limiter for each endpoint is granted 30 tokens to start
    • I cannot find documentation on which endpoints are public and private, but under controlled testing circumstances each of the endpoints I access are confirmed to handle a load of 30 per second following this process
  2. Foreach API request (per endpoint):
    1. Token is requested
      • If there are available tokens, grants token immediately
      • Otherwise, waits for a token to be released
    2. API request is made and awaited, process continues regardless of API success
    3. Wait 1 full second
    4. Release token

Get Server Time is only public endpoint, all other are private.

3 Likes