Rate Limits
The WebSocket API rate limits requests and connections by IP address.
If you exceed a rate limit, an error is thrown and your requests will be blocked for 2 minutes.
Rate limits for the WebSocket API are as follows:
Type | Limit |
---|---|
Connections | 10 active connections per IP address. |
Requests | 40 requests per 1 minute per IP address. Requests are counted, in total, across your active connections. |
Best Practices
To avoid rate limiting, sFOX recommends following these best practices:
1. Consolidate feeds per subscribe/unsubscribe request
Subscribe/unsubscribe to multiple WebSocket feeds in a single request rather than sending subscribe requests per WebSocket feed.
For example, if you want to subscribe to both the open orders and balances feeds:
2. Consolidate WebSocket consumption by connection
Consuming the same data across >1 connection will result in duplicate requests. For example, if you want consume the BTC/USD order book, do so in a single connection.
Please note: To ensure optimal performance, sFOX recommends using a separate WebSocket connection for each feed "type" you subscribe to.
For example, consume market data and orders/account data in separate connections.
This segregation ensures that time-sensitive updates, such as balances or open-orders messages, are not impacted by high-frequency feeds like order books.
Last updated