Question

What can I do to avoid being rate limited?

Answer

Typically, slowing down is all you need to do to solve the issue, but users have various options to avoid being rate-limited.

Sandwich takes a conservative approach to the consumption of rate limits: where possible, Sandwich subscribes to WebSockets for data (as opposed to making rest requests). Furthermore, where exchanges offer the functionality, Sandwich aggregates simultaneous order placement and cancellation requests for bulk placement/cancellation on the exchange.

Sandwich also shows rate limits and current consumption to users, so that they know their status and can manage it. This information is accessible by using the context menu accessible by Secondary Click (right-click) on the relevant account in the Loaded Accounts section and selecting Rest Request Details.

To aid users, the Sandwich app implements an internal queue that helps distribute requests in scenarios where rate limits are being approached. This is a mechanism that aims to aid users and improve stability, but it should not be relied upon for continuous use. The queue length is visible in the Rest Request Details view.

If you receive an error message like “API rate limit exceeded” or “You are being rate limited”, it is time to slow down.

The first and most important thing is to slow down usage on the app. Execution algos with short intervals can be high rate limit consumers. Additionally, close unused DMA windows. Users can also consider reducing the number of accounts loaded on a particular exchange.

Furthermore, a user needs to understand whether they are being rate limited on an IP-wide, account-wide or sub account-wide level. The Rest Request Details view should indicate whether public or private rate limits are nearing capacity. If rate limits are applied on an account-wide basis, users can split their various trading strategies across multiple sub accounts. If rate limits are applied on an IP-wide basis (think of a trading office),  users can consider using another network (WiFi / Fiber / VPN) to access the exchange with new rate limits.

Different exchanges implement rate limiting with different levels of severity: some exchanges block calls for a few minutes whilst others issue a permanent ban on the IP / API key. Hitting and breaching rate limits is a situation that is best avoided.

Sandwich is working on a longer-term solution for IP rate limited traders in the same office, but it will take some time to implement. Please contact us by email if you need more information.