Rate Limit
Rate limits are mainly divided into two types.
IP Rate Limit, which is based on the user's IP address and limits the access rate from that IP. Currently, the limit setting is relatively high, and users generally will not trigger such limits.
User Rate Limit, which is based on the user's trading account. It includes a Short Cycle Rate Limit and a Long Cycle Rate Limit. Their differences are as follows:
Short Cycle Rate Limit
: The main account and its created sub-accounts are independently subject to theShort Cycle Rate Limit
. This means that each account has its own limits and quotas, which are independent of other accounts.Long Cycle Rate Limit
: The main account and its created sub-accounts share the same rate limit quota. This means that requests from all accounts will affect this shared quota, and requests from all accounts will be deducted from the same quota.
IP Rate Limit
Rate limit: 400/s
User Rate Limit
User Rate Limit is divided into two modes: Short Cycle Rate Limit
and Long Cycle Rate Limit
.
Short Cycle Rate limit
tends to control the short-term request volume and prevent malicious use of the API.Long Cycle Rate Limit
tends to control the long-term request volume and prevent abuse of API resources.
Short Cycle Rate Limit
The current rate limits are based on groups, and the corresponding relationships between groups can be seen in the following section.
This rate limit strategy is based on grouped request paths to control the request frequency on specific paths. Here is a detailed description:
Grouping: Request paths are divided into multiple groups, each group containing a set of related paths. Paths with similar functions or characteristics are grouped together.
Request Quota: Each group has a shared request quota that represents the number of requests allowed for that group within a specific period. The quota is dynamically restored based on the rate-limiting frequency.
Rate Limiting Frequency: Each group will have a rate-limiting frequency, which is the maximum amount of request quota that can be recovered per second. For example, if the rate limiting frequency is 20r/s, it means that the request quota recovers by 20 requests per second.
Rate Limiting Strategy: When a request is received, the system first determines the group to which the request belongs. Then, the system checks if the request quota for that group allows processing of the request.
a. If the request quota is higher than zero, the request is allowed to be processed and the quota is reduced. After the request is processed, the system can return the corresponding results.
b. If the request margin is zero, the request will be refused. The system will return an error code indicating that the request has exceeded the usage limit.
- Account Short Cycle Rate Limit (Spot)
- The main and sub-accounts are separately rate-limited and do not affect each other.
Endpoint Type | Rate Limit | Path |
---|---|---|
Place & Modify Spot Order | 30r/1s | POST /spot/order *Place order |
POST /spot/stop-order *Place stop order | ||
POST /spot/modify-order *Modify order | ||
POST /spot/modify-stop-order *Modify stop order | ||
Cancel Spot Order | 60r/1s | POST /spot/cancel-order *Cancel order |
POST /spot/cancel-stop-order *Cancel stop order | ||
Batch Place Order | 10r/1s | POST /spot/batch-order *Place order in batch |
POST /spot/batch-stop-order *Place stop order in batch | ||
Batch Cancel Spot Order | 40r/1s | POST /spot/cancel-batch-order *Cancel order in batch |
Get Spot Order Status | 50r/1s | GET /spot/order-status *Get order status |
GET /spot/batch-order-status *Batch get order status | ||
GET /spot/pending-order *Get pending order | ||
GET /spot/pending-stop-order *Get pending stop order | ||
Get Spot Order History | 10r/1s | GET /spot/order-deals *Get order deals |
GET /spot/user-deals *Get user deals | ||
GET /spot/finished-order *Get finished order | ||
GET /spot/finished-stop-order *Get finished stop order | ||
Modify Spot Account | 10r/1s | POST /account/settings *Modify Account Settings |
POST /assets/margin-borrow *Margin Borrow | ||
POST /assets/margin-repay *Margin Repay | ||
POST /assets/transfer *Asset Transfer | ||
POST /account/subs *Create subaccount | ||
POST /account/subs/frozen *Freeze subaccount | ||
POST /account/subs/unfrozen *Unfreeze subaccount | ||
POST /account/subs/api *Create subaccount APIKEY | ||
POST /account/subs/edit-api *Modify subaccount APIKEY | ||
POST /account/subs/delete-api *Delete subaccount APIKEY | ||
POST /account/subs/transfer *Subaccount asset transfer | ||
POST /assets/renewal-deposit-address *Renew deposit address | ||
POST /assets/withdraw *Submit withdrawal | ||
POST /assets/cancel-withdraw *Cancel withdrawal | ||
Get Spot Account Status | 10r/1s | GET /assets/spot/balance *Get spot account balance |
GET /account/trade-fee-rate *Get trading fee rate | ||
GET /assets/amm/liquidity *Get AMM account liquidity | ||
GET /assets/financial/balance *Get financial account balance | ||
GET /assets/credit/info *Get credit account info | ||
GET /account/subs/api *Get subaccount APIKEY list | ||
GET /account/subs/api-detail *Get subaccount APIKEY details | ||
GET /assets/deposit-address *Get deposit address | ||
Get Spot Account Record | 10r/1s | GET /assets/withdraw *Get withdrawal history |
GET /assets/deposit-history *Get deposit history | ||
GET /assets/statement *Get user assets history | ||
GET /assets/transfer-history *Get account transfer history | ||
GET /assets/margin/borrow-history *Get margin borrow history | ||
GET /account/subs/transfer-history *Get subaccount transfer history |
- Account Short Cycle Rate Limit (Futures)
- The main and sub-accounts are separately rate-limited and do not affect each other.
Endpoint type | Rate limit | Including the below endpoint paths |
---|---|---|
Futures order placement, modification and position adjustment | 20r/1s | POST /futures/order *Place order |
POST /futures/stop-order *Place stop order | ||
POST /futures/close-position *Market close all position | ||
POST /futures/adjust-position-margin *Adjust position margin | ||
POST /futures/adjust-position-leverage *Adjust position leverage | ||
POST /futures/set-position-stop-loss *Set position stop loss | ||
POST /futures/set-position-take-profit *Set position take profit | ||
POST /futures/modify-order *Modify order | ||
POST /futures/modify-stop-order *Modify stop order | ||
Cancel futures order | 40r/1s | POST /futures/cancel-order *Cancel order |
POST /futures/cancel-stop-order *Cancel stop order | ||
Batch Place Order | 10r/1s | POST /futures/batch-order *Place order in batch |
POST /futures/batch-stop-order *Place stop order in batch | ||
Batch cancel futures orders | 20r/1s | POST /futures/cancel-batch-order *Batch cancel orders |
POST /futures/cancel-batch-stop-order *Batch cancel stop orders | ||
Query futures order | 50r/1s | GET /futures/pending-order *Get unfilled order |
GET /futures/pending-stop-order *Get unfilled stop order | ||
GET /futures/order-status *Query order status | ||
Query futures order history | 10r/1s | GET /futures/finished-order *Get filled order |
GET /futures/finished-stop-order *Get filled stop order | ||
Query futures account | 10r/1s | GET /assets/futures/balance *Get futures account balance |
GET /futures/position-funding-history *Get position funding rate history | ||
GET /futures/pending-position *Get current position |
When accessing an endpoint that triggers rate limit, the following two Header
will be returned in the HTTP response header.
X-RateLimit-Limit
. This value indicates the maximum number of accesses per second allowed by the group to which the endpoint belongs.X-RateLimit-Remaining
. This value indicates the current number of remaining accesses for the group to which the endpoint belongs.X-RateLimit-LongPeriod-{period}-Remaining
.This value indicates the number of remaining accesses in the currently configured long period of the group to which the endpoint belongs, and period indicates the limit period, such as 1H, 4H, 8H or 24H.
Long Cycle Rate Limit
Long Cycle Rate Limit primarily evaluates the user's request volume
and request quality
to determine whether to restrict the total volume of requests within a longer cycle
. Among them, request quality
mainly includes other reference indicators such as effective trading rate
and average order survival time
.
The concepts mentioned above are explained as follows:
Cycle
. Unlike short cycle rate limit, the cycle here refers to a longer statistical cycle, such as 1h, 4h, 8h, or 24h.Request Volume
. The total sum of all requests within onecycle
for a specificgroup
.Request Quality
. It mainly includes other reference indicators such aseffective trading rate
andaverage order lifespan
.Effective Trading Rate
. Theeffective trading rate
in a cycle = the number of valid orders (completed orders with executive trading) / the total number of orders.Average Order Lifespan
. The average lifespan of orders within a cycle, calculated as the difference between the creation time and completion time of each order.
Only when both the request volume
and request quality
indicators exceed the limit will it be affected by long cycle rate limit.
The long cycle rate limit will be reset after the end of a cycle and the statistics of the cycle are based on whole hours. For example, assuming that the period of the long cycle rate limit is 8h, then there will be three statistical cycles in a day, namely 0~8h
, 8~16h
, 16~24h
.
After the long cycle rate limit is triggered, API requests will be placed in low-speed mode
, where the allowed rate for each group will be significantly reduced. However, it will not restrict users from canceling orders.
When accessing an endpoint that triggers long-term rate limit, the following Header
will be returned in the HTTP response header.
X-RateLimit-LongPeriod-{period}-Remaining
.This value indicates the number of remaining accesses in the currently configured long period of the group to which the endpoint belongs, and period indicates the limit period, such as 1H, 4H, 8H or 24H.For example: X-RateLimit-LongPeriod-24H-Remaining.In addition, there may be multiple long-period frequency limiting rules in effect at the same time, that is, multiple headers with different periods will be returned at the same time.
- Common error codes and processing methods after the rate limit is triggered.
Error Code | Method |
---|---|
3008 | Service busy, please try again later. |
4001 | Service unavailable, please try again later. |
4213 | Rate limit triggered. Please adjust your strategy and reduce the request rate. |
- Other error handling
If you encounter other errors, you can refer to Error Handling.