Table of Contents
Overview
See the Limit API pages for details:
Limits of REST API limits
- Public endpoints: 10 requests per second, up to 15 requests per second in batch mode.
- Private endpoints: 15 requests per second, up to 30 requests per second in batch mode.
- Private endpoint/fill: 10 queries per second and up to 20 consecutive queries per second.
Limits of FIX API limits
- About 50 requests per second per session
- at the rate of 100 messages per second in groups
Internet speed limits
- 8 requests per second per IP and up to 20 requests in batch mode
- Messages sent by the client: 100 per second per IP
How limit limits work
Limit limits for both the Exchange REST API and the FIX API use a delayed fill token block implementation.
TokenBucket stores a maximum number of tokens equal to the packet size and fills at a certain frequency, called the refresh rate. The bucket begins to fill, and as requests are received, a token is issued for each request. Tokens are continually added to the refresh frequency garbage can until it is full.
When the user submits a request, TokenBucket calculates whether to restrict the user as follows:
- Fill the user’s tokenBucket to the token size using the following formula: token_amount = min(burst, previous_token_amount + (current_time – previous_request_time) * Refresh_rate)
- Remove the token if possible, otherwise restrict the request.
- Repeat steps 1 and 2 for each additional requirement.
An example of a character group
Suppose you have a token bucket with Burst = 3 and Refresh_rate = 1. The following table shows the state of your token bucket after a series of queries:
Action |
Time |
Tokens |
Notes |
Initial State |
0.0 |
3.0 |
New TokenBucket is initialized to max capacity (burst) |
Request 1 |
0.5 |
2.0 |
Fill TokenBucket, then remove a token, because we are at max capacity, and subtract 1 token from 3 |
Request 2 |
0.8 |
1.3 |
Fill TokenBucket to 2.3 (min(3, (2 + (.8 – .5) * 1.0)) = min(3, 2.3) = 2.3), then subtract 1 |
Request 3 |
0.9 |
0.4 |
Fill TokenBucket to 1.4 (min(3, (1.3 + (.9 – .8) * 1.0)) = min(3, 1.4) = 1.4), then subtract 1 |
Request 4 |
1.0 |
0.5 |
Fill TokenBucket to 0.5 (min(3, (.4 + (1.0 – .9) * 1.0)) = min(3, 0.5) = 0.5). Ratelimit because we don’t have enough tokens available |
Request 5 |
1.4 |
0.9 |
Fill TokenBucket to 0.9 (min(3, (0.5 + (1.4 – 1.0) * 1.0)) = min(3, 0.9) = 0.9). Ratelimit because we don’t have enough tokens available |
Request 6 |
1.8 |
0.3 |
Fill TokenBucket to 1.3 (min(3, (0.9 + (1.8 – 1.4) * 1.0)) = min(3, 1.3) = 1.3), then remove 1 |
Request 7 |
5.0 |
2.0 |
Fill TokenBucket to 3.0 (min(3, (0.3 + (5.0 – 1.8) * 1.0)) = min(3, 3.5) = 3), since we would “overflow” with our calculations, then subtract 1 |