Rate Limiting

Rate Limiting

This page is concerned with providing you with specific information on rate limiting.

We introduce rate limits to ensure fair access to the platform for everyone. You can be sure that everybody has to follow the same set of rules. We will throttle the access of anyone trying to exceed certain limits.

This way, you can be sure the lemon.markets API will be available for you whenever you like. You will not be restricted by the way other people use the API.

Rate Limits

These are the rate limits for our different environments:

EnvironmentRate Limit
Market Data10-60 requests/min (according to your pricing tier)
Live Streaming5 requests/min
Paper Trading60 requests/min
Live Trading150 requests/min

Temporary Exemption for Early Customers

Early customers are temporarily exempt from those limits and may see higher rate limits for the time being.

HTTP Response Headers

These are the HTTP response headers that you will see for every API request:

HTTP Response HeaderDescription
RateLimit-LimitNumber of permitted API requests per time interval (currently: per minute).
RateLimit-RemainingNumber of permitted API requests left in this time interval.
RateLimit-ResetNumber of seconds until the current time interval ends.

In order to maximize the use of the platform we recommend against the use of constants in your code. Instead of having a constant like rate_limit_trading, we recommend to use at least a variable and update it with the value from the RateLimit-Limit header.

This will improve your code in two ways:

  1. If there is a technical problem with the platform (e.g. due to unexpected failure of underlying services), we may reduce the rate limits to ensure availability of the platform for everyone.
  2. In case lemon.markets decides to change these rate limits (e.g. because we want you to be able to trade more), you can pick up these changes as they are implemented.

Hitting the Rate Limit

If a user performs too many requests per time interval, they will receive the HTTP status code 429 Too Many Requests. In addition to the other response headers, the following will be sent as well.

HTTP Response HeaderDescription
Retry-AfterNumber of seconds until the user can issue successful requests again. (This will essentially be the same value as the header RateLimit-Reset.)

We strongly recommend you wait the specified amount of time before making another request.