- Change Log
- General Info
- General API Information
- LIMITS
- Endpoint Security Type
- SIGNED (TRADE and USER_DATA) Endpoint Security
- Timing security
- SIGNED Endpoint Examples for POST /fapi/v1/order
- Example 1: As a query string
- Example 2: As a request body
- Example 3: Mixed query string and request body
- Public Endpoints Info
- Terminology
- ENUM definitions
- Filters
- Symbol filters
- PRICE_FILTER
- LOT_SIZE
- MARKET_LOT_SIZE
- MAX_NUM_ORDERS
- PERCENT_PRICE
- Market Data Endpoints
- Test Connectivity
- Check Server time
- Exchange Information
- Order Book
- Recent Trades List
- Old Trades Lookup
- Compressed/Aggregate Trades List
- Kline/Candlestick Data
- Mark Price
- 24hr Ticker Price Change Statistics
- Symbol Price Ticker
- Symbol Order Book Ticker
- Websocket Market Streams
- Aggregate Trade Streams
- Mark Price Stream
- Kline/Candlestick Streams
- Individual Symbol Mini Ticker Stream
- Individual Symbol Ticker Streams
- Partial Book Depth Streams
- How to manage a local order book correctly
- Account/Trades Endpoints
- New Order (TRADE)
- Query Order (USER_DATA)
- Cancel Order (TRADE)
- Current Open Orders (USER_DATA)
- All Orders (USER_DATA)
- Account Information (USER_DATA)
- Position Information (USER_DATA)
- Account Trade List (USER_DATA)
- User Data Streams
- Start User Data Stream (USER_STREAM)
- Keepalive User Data Stream (USER_STREAM)
- Close User Data Stream (USER_STREAM)
- Event: Balance and Position Update
- Event: Order Update
- Error Codes
- 10xx — General Server or Network issues
- -1000 UNKNOWN
- -1001 DISCONNECTED
- -1002 UNAUTHORIZED
- -1003 TOO_MANY_REQUESTS
- -1004 DUPLICATE_IP
- -1005 NO_SUCH_IP
- -1006 UNEXPECTED_RESP
- -1007 TIMEOUT
- -1010 ERROR_MSG_RECEIVED
- -1011 NON_WHITE_LIST
- -1013 ILLEGAL_MESSAGE
- -1014 UNKNOWN_ORDER_COMPOSITION
- -1015 TOO_MANY_ORDERS
- -1016 SERVICE_SHUTTING_DOWN
- -1020 UNSUPPORTED_OPERATION
- -1021 INVALID_TIMESTAMP
- -1022 INVALID_SIGNATURE
- 11xx — Request issues
- -1100 ILLEGAL_CHARS
- -1101 TOO_MANY_PARAMETERS
- -1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED
- -1103 UNKNOWN_PARAM
- -1104 UNREAD_PARAMETERS
- -1105 PARAM_EMPTY
- -1106 PARAM_NOT_REQUIRED
- -1108 BAD_ASSET
- -1109 BAD_ACCOUNT
- -1110 BAD_INSTRUMENT_TYPE
- -1111 BAD_PRECISION
- -1112 NO_DEPTH
- -1113 WITHDRAW_NOT_NEGATIVE
- -1114 TIF_NOT_REQUIRED
- -1115 INVALID_TIF
- -1116 INVALID_ORDER_TYPE
- -1117 INVALID_SIDE
- -1118 EMPTY_NEW_CL_ORD_ID
- -1119 EMPTY_ORG_CL_ORD_ID
- -1120 BAD_INTERVAL
- -1121 BAD_SYMBOL
- -1125 INVALID_LISTEN_KEY
- -1127 MORE_THAN_XX_HOURS
- -1128 OPTIONAL_PARAMS_BAD_COMBO
- -1130 INVALID_PARAMETER
- -2008 BAD_API_ID
- -2010 NEW_ORDER_REJECTED
- -2011 CANCEL_REJECTED
- -2013 NO_SUCH_ORDER
- -2014 BAD_API_KEY_FMT
- -2015 REJECTED_MBX_KEY
- -2016 NO_TRADING_WINDOW
- -4000 INVALID_ORDER_STATUS
- -4001 PRICE_LESS_THAN_ZERO
- -4002 PRICE_GREATER_THAN_MAX_PRICE
- -4003 QTY_LESS_THAN_ZERO
- -4004 QTY_LESS_THAN_MIN_QTY
- -4005 QTY_GREATER_THAN_MAX_QTY
- -4006 STOP_PRICE_LESS_THAN_ZERO
- -4006 STOP_PRICE_GREATER_THAN_MAX_PRICE
- Messages for -1010 ERROR_MSG_RECEIVED, -2010 NEW_ORDER_REJECTED, and -2011 CANCEL_REJECTED
Change Log
2019-09-20
New returned values in response to GET /fapi/v1/account:
maxWithdrawAmount , openOrderInitialMargin , positionInitialMargin
New returned values in response to GET /fapi/v1/positionRisk:
liquidationPrice
General Info
General API Information
- The base endpoint is: https://testnet.binancefuture.com
- All endpoints return either a JSON object or array.
- Data is returned in ascending order. Oldest first, newest last.
- All time and timestamp related fields are in milliseconds.
- HTTP 4XX return codes are used for for malformed requests; the issue is on the sender’s side.
- HTTP 429 return code is used when breaking a request rate limit.
- HTTP 418 return code is used when an IP has been auto-banned for continuing to send requests after receiving 429 codes.
- HTTP 5XX return codes are used for internal errors; the issue is on Binance’s side. It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success.
- Any endpoint can return an ERROR.
The error payload is as follows:
- Specific error codes and messages defined in Error Codes.
- For GET endpoints, parameters must be sent as a query string .
- For POST , PUT , and DELETE endpoints, the parameters may be sent as a query string or in the request body with content type application/x-www-form-urlencoded . You may mix parameters between both the query string and request body if you wish to do so.
- Parameters may be sent in any order.
- If a parameter sent in both the query string and request body , the query string parameter will be used.
LIMITS
- The /fapi/v1/exchangeInfo rateLimits array contains objects related to the exchange’s RAW_REQUEST , REQUEST_WEIGHT , and ORDER rate limits. These are further defined in the ENUM definitions section under Rate limiters (rateLimitType) .
- A 429 will be returned when either rate limit is violated.
- Each route has a weight which determines for the number of requests each endpoint counts for. Heavier endpoints and endpoints that do operations on multiple symbols will have a heavier weight .
- Every request will contain a X-MBX-USED-WEIGHT header which has the current used weight for the IP for the current minute.
- When a 429 returned, it’s your obligation as an API to back off and not spam the API.
- Repeatedly violating rate limits and/or failing to back off after receiving 429 will result in an automated IP ban (http status 418 ).
- IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days.
- A Retry-After header is sent with a 418 or 429 responses and will give the number of seconds required to wait, in the case of a 418 , to prevent a ban, or, in the case of a 429 , until the ban is over.
Endpoint Security Type
- Each endpoint has a security type that determines the how you will interact with it.
- API-keys are passed into the Rest API via the X-MBX-APIKEY header.
- API-keys and secret-keys are case sensitive.
- API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes.
- By default, API-keys can access all secure routes.
Security Type | Description |
---|---|
NONE | Endpoint can be accessed freely. |
TRADE | Endpoint requires sending a valid API-Key and signature. |
USER_DATA | Endpoint requires sending a valid API-Key and signature. |
USER_STREAM | Endpoint requires sending a valid API-Key. |
MARKET_DATA | Endpoint requires sending a valid API-Key. |
- TRADE and USER_DATA endpoints are SIGNED endpoints.
SIGNED (TRADE and USER_DATA) Endpoint Security
- SIGNED endpoints require an additional parameter, signature , to be sent in the query string or request body .
- Endpoints use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your secretKey as the key and totalParams as the value for the HMAC operation.
- The signature is not case sensitive.
- Please make sure the signature is the end part of your query string or request body .
- totalParams is defined as the query string concatenated with the request body .
Timing security
- A SIGNED endpoint also requires a parameter, timestamp , to be sent which should be the millisecond timestamp of when the request was created and sent.
- An additional parameter, recvWindow , may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000.
Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow , you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server.
SIGNED Endpoint Examples for POST /fapi/v1/order
Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using echo , openssl , and curl .
Key | Value |
---|---|
apiKey | vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A |
secretKey | NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j |
Parameter | Value |
---|---|
symbol | BTCUSDT |
side | BUY |
type | LIMIT |
timeInForce | GTC |
quantity | 1 |
price | 0.1 |
recvWindow | 5000 |
timestamp | 1499827319559 |
Example 1: As a query string
HMAC SHA256 signature:
queryString:
symbol=BTCUSDT
&side=BUY
&type=LIMIT
&timeInForce=GTC
&quantity=1
&price=0.1
&recvWindow=5000
×tamp=1499827319559
Example 2: As a request body
HMAC SHA256 signature:
requestBody:
symbol=BTCUSDT
&side=BUY
&type=LIMIT
&timeInForce=GTC
&quantity=1
&price=0.1
&recvWindow=5000
×tamp=1499827319559
Example 3: Mixed query string and request body
HMAC SHA256 signature:
- queryString: symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC
- requestBody: quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559
Note that the signature is different in example 3.
There is no & between «GTC» and «quantity=1».
Public Endpoints Info
Terminology
- base asset refers to the asset that is the quantity of a symbol.
- quote asset refers to the asset that is the price of a symbol.
ENUM definitions
Symbol type:
Order status (status):
Order types (orderTypes, type):
Order side (side):
Time in force (timeInForce):
- GTC — Good Till Cancel
- OC — Immediate or Cancel
- FOK — Fill or Kill
- GTX — Good Till Crossing (Post Only)
Kline/Candlestick chart intervals:
m -> minutes; h -> hours; d -> days; w -> weeks; M -> months
Rate limiters (rateLimitType)
Rate limit intervals (interval)
Filters
Filters define trading rules on a symbol or an exchange.
Symbol filters
PRICE_FILTER
The PRICE_FILTER defines the price rules for a symbol. There are 3 parts:
- minPrice defines the minimum price / stopPrice allowed; disabled on minPrice == 0.
- maxPrice defines the maximum price / stopPrice allowed; disabled on maxPrice == 0.
- tickSize defines the intervals that a price / stopPrice can be increased/decreased by; disabled on tickSize == 0.
Any of the above variables can be set to 0, which disables that rule in the price filter . In order to pass the price filter , the following must be true for price / stopPrice of the enabled rules:
- price >= minPrice
- price maxPrice
- ( price — minPrice ) % tickSize == 0
LOT_SIZE
The LOT_SIZE filter defines the quantity (aka «lots» in auction terms) rules for a symbol. There are 3 parts:
- minQty defines the minimum quantity allowed.
- maxQty defines the maximum quantity allowed.
- stepSize defines the intervals that a quantity can be increased/decreased by.
In order to pass the lot size , the following must be true for quantity :
- quantity >= minQty
- quantity maxQty
- ( quantity — minQty ) % stepSize == 0
MARKET_LOT_SIZE
The MARKET_LOT_SIZE filter defines the quantity (aka «lots» in auction terms) rules for MARKET orders on a symbol. There are 3 parts:
- minQty defines the minimum quantity allowed.
- maxQty defines the maximum quantity allowed.
- stepSize defines the intervals that a quantity can be increased/decreased by.
In order to pass the market lot size , the following must be true for quantity :
- quantity >= minQty
- quantity maxQty
- ( quantity — minQty ) % stepSize == 0
MAX_NUM_ORDERS
The MAX_NUM_ORDERS filter defines the maximum number of orders an account is allowed to have open on a symbol. Note that both «algo» orders and normal orders are counted for this filter.
PERCENT_PRICE
The PERCENT_PRICE filter defines valid range for a price based on the mark price.
In order to pass the percent price , the following must be true for price :
- price markPrice * multiplierUp
- price >= markPrice * multiplierDown
Market Data Endpoints
Test Connectivity
Test connectivity to the Rest API.
Weight: 1
Parameters: NONE
Check Server time
Test connectivity to the Rest API and get the current server time.
Weight: 1
Parameters: NONE
Exchange Information
Current exchange trading rules and symbol information
Weight: 1
Parameters: NONE
Order Book
Weight:
Adjusted based on the limit:
Limit | Weight |
---|---|
5, 10, 20, 50, 100 | 1 |
500 | 5 |
1000 | 10 |
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
limit | INT | NO | Default 100; max 1000. Valid limits:[5, 10, 20, 50, 100, 500, 1000] |
Recent Trades List
Get recent trades (up to last 500).
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
limit | INT | NO | Default 500; max 1000. |
Old Trades Lookup
Get older market historical trades.
Weight: 5
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
limit | INT | NO | Default 500; max 1000. |
fromId | LONG | NO | TradeId to fetch from. Default gets most recent trades. |
- X-MBX-APIKEY required
Compressed/Aggregate Trades List
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
fromId | LONG | NO | ID to get aggregate trades from INCLUSIVE. |
startTime | LONG | NO | Timestamp in ms to get aggregate trades from INCLUSIVE. |
endTime | LONG | NO | Timestamp in ms to get aggregate trades until INCLUSIVE. |
limit | INT | NO | Default 500; max 1000. |
- If both startTime and endTime are sent, time between startTime and endTime must be less than 1 hour.
- If fromId, startTime, and endTime are not sent, the most recent aggregate trades will be returned.
Kline/Candlestick Data
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
interval | ENUM | YES | |
startTime | LONG | NO | |
endTime | LONG | NO | |
limit | INT | NO | Default 500; max 1500. |
- If startTime and endTime are not sent, the most recent klines are returned.
Mark Price
Mark Price and Funding Rate
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES |
24hr Ticker Price Change Statistics
24 hour rolling window price change statistics.
Careful when accessing this with no symbol.
Weight:
1 for a single symbol;
40 when the symbol parameter is omitted
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO |
- If the symbol is not sent, tickers for all symbols will be returned in an array.
Symbol Price Ticker
Latest price for a symbol or symbols.
Weight:
1 for a single symbol;
2 when the symbol parameter is omitted
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO |
- If the symbol is not sent, prices for all symbols will be returned in an array.
Symbol Order Book Ticker
Best price/qty on the order book for a symbol or symbols.
Weight:
1 for a single symbol;
2 when the symbol parameter is omitted
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO |
- If the symbol is not sent, bookTickers for all symbols will be returned in an array.
Websocket Market Streams
- The base endpoint is: wss://testnet.binancefuture.com
- Streams can be access either in a single raw stream or a combined stream
- Raw streams are accessed at /ws/
- Combined streams are accessed at /stream?streams= / /
- Combined stream events are wrapped as follows:
- All symbols for streams are lowercase
- The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed.
Aggregate Trade Streams
The Aggregate Trade Streams push trade information that is aggregated for a single taker order every 100 milliseconds.
Stream Name:
@aggTrade
Mark Price Stream
Mark price for a single symbol pushed every 3 secends.
Stream Name:
@markPrice
Kline/Candlestick Streams
The Kline/Candlestick Stream push updates to the current klines/candlestick every 250 milliseconds (if existing).
Kline/Candlestick chart intervals:
m -> minutes; h -> hours; d -> days; w -> weeks; M -> months
Stream Name:
@kline_
Individual Symbol Mini Ticker Stream
24hr rolling window mini-ticker statistics for a single symbol pushed every 3 seconds. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before.
Stream Name:
@miniTicker
Individual Symbol Ticker Streams
24hr rollwing window ticker statistics for a single symbol pushed every 3 seconds. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before.
Stream Name:
@ticker
Partial Book Depth Streams
Bids and asks, pushed every 250 milliseconds (if existing)
Stream Name:
@depth
How to manage a local order book correctly
- Open a stream to wss://testnet.binancefuture.com/stream?streams=btcusdt@depth.
- Buffer the events you receive from the stream. For same price, latest received update covers the previous one.
- Get a depth snapshot from https://testnet.binancefuture.com/fapi/v1/depth?symbol=BTCUSDT&limit=1000 .
- Drop any event where u is lastUpdateId in the snapshot
- The first processed event should have U lastUpdateId AND u >= lastUpdateId
- While listening to the stream, each new event’s pu should be equal to the previous event’s u , otherwise initialize the process from step 3.
- The data in each event is the absolute quantity for a price level
- If the quantity is 0, remove the price level
- Receiving an event that removes a price level that is not in your local order book can happen and is normal.
Account/Trades Endpoints
New Order (TRADE)
POST /fapi/v1/order (HMAC SHA256)
Send in a new order.
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
side | ENUM | YES | |
type | ENUM | YES | |
timeInForce | ENUM | NO | |
quantity | DECIMAL | YES | |
price | DECIMAL | NO | |
newClientOrderId | STRING | NO | A unique id for the order. Automatically generated if not sent. |
stopPrice | DECIMAL | NO | Used with STOP orders. |
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Additional mandatory parameters based on type :
Type | Additional mandatory parameters |
---|---|
LIMIT | timeInForce , quantity , price |
MARKET | quantity |
STOP | quantity , price , stopPrice |
- Order with type MARKET , parameter timeInForce cannot be sent.
- Order with type STOP , parameter timeInForce can be sent ( default GTC ).
Query Order (USER_DATA)
GET /fapi/v1/order (HMAC SHA256)
Check an order’s status.
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderId | LONG | NO | |
origClientOrderId | STRING | NO | |
recvWindow | LONG | NO | |
timestamp | LONG | YES |
- Either orderId or origClientOrderId must be sent.
Cancel Order (TRADE)
DELETE /fapi/v1/order (HMAC SHA256)
Cancel an active order.
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderId | LONG | NO | |
origClientOrderId | STRING | NO | Automatically generated by default. |
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Either orderId or origClientOrderId must be sent.
Current Open Orders (USER_DATA)
GET /fapi/v1/openOrders (HMAC SHA256)
Get all open orders on a symbol. Careful when accessing this with no symbol.
Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO | |
recvWindow | LONG | NO | |
timestamp | LONG | YES |
- If the symbol is not sent, orders for all symbols will be returned in an array.
All Orders (USER_DATA)
GET /fapi/v1/allOrders (HMAC SHA256)
Get all account orders; active, canceled, or filled.
Weight: 5 with symbol
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderId | LONG | NO | |
startTime | LONG | NO | |
endTime | LONG | NO | |
limit | INT | NO | Default 500; max 1000. |
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Notes:
- If orderId is set, it will get orders >= that orderId . Otherwise most recent orders are returned.
Account Information (USER_DATA)
GET /fapi/v1/account (HMAC SHA256)
Get current account information.
Weight: 5
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Position Information (USER_DATA)
GET /fapi/v1/positionRisk (HMAC SHA256) Get current account information.
Weight: 5
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Account Trade List (USER_DATA)
GET /fapi/v1/userTrades (HMAC SHA256)
Get trades for a specific account and symbol.
Weight: 5 with symbol
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
startTime | LONG | NO | |
endTime | LONG | NO | |
fromId | LONG | NO | TradeId to fetch from. Default gets most recent trades. |
limit | INT | NO | Default 500; max 1000. |
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Notes:
- If fromId is set, it will get orders >= that fromId . Otherwise most recent orders are returned.
User Data Streams
- The base API endpoint is: https://testnet.binancefuture.com
- A User Data Stream listenKey is valid for 30 minutes after creation.
- Doing a PUT on a listenKey will extend its validity for 30 minutes.
- Doing a DELETE on a listenKey will close the stream.
- The base websocket endpoint is: wss://testnet.binancefuture.com
- User Data Streams are accessed at /ws/
- User data stream payloads are not guaranteed to be in order during heavy periods; make sure to order your updates using E
Start User Data Stream (USER_STREAM)
POST /fapi/v1/listenKey (HMAC SHA256)
Start a new user data stream. The stream will close after 30 minutes unless a keepalive is sent.
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Keepalive User Data Stream (USER_STREAM)
PUT /fapi/v1/listenKey (HMAC SHA256)
Keepalive a user data stream to prevent a time out. User data streams will close after 30 minutes. It’s recommended to send a ping about every 30 minutes.
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Close User Data Stream (USER_STREAM)
DELETE /fapi/v1/listenKey (HMAC SHA256)
Close out a user data stream.
Weight: 1
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | |
timestamp | LONG | YES |
Event: Balance and Position Update
Event type is ACCOUNT_UPDATE .
When balance or position get updated, will push this event.
Event: Order Update
When new order created, order status changed will push such event. event type is ORDER_TRADE_UPDATE .
Side
Order Type
Execution Type
- NEW
- PARTIAL_FILL
- FILL
- CANCELED
- REJECTED
- CALCULATED — Liquidation Execution
- EXPIRED
- TRADE
- RESTATED
Order Status
- NEW
- PARTIALLY_FILLED
- FILLED
- CANCELED
- REPLACED
- STOPPED
- REJECTED
- EXPIRED
- NEW_INSURANCE — Liquidation with Insurance Fund
- NEW_ADL — Counterparty Liquidation`
Time in force
Error Codes
Here is the error JSON payload:
Errors consist of two parts: an error code and a message.
Codes are universal,but messages can vary.
10xx — General Server or Network issues
-1000 UNKNOWN
- An unknown error occured while processing the request.
-1001 DISCONNECTED
- Internal error; unable to process your request. Please try again.
-1002 UNAUTHORIZED
- You are not authorized to execute this request.
-1003 TOO_MANY_REQUESTS
- Too many requests queued.
- Too many requests; please use the websocket for live updates.
- Too many requests; current limit is %s requests per minute. Please use the websocket for live updates to avoid polling the API.
- Way too many requests; IP banned until %s. Please use the websocket for live updates to avoid bans.
-1004 DUPLICATE_IP
- This IP is already on the white list
-1005 NO_SUCH_IP
- No such IP has been white listed
-1006 UNEXPECTED_RESP
- An unexpected response was received from the message bus. Execution status unknown.
-1007 TIMEOUT
- Timeout waiting for response from backend server. Send status unknown; execution status unknown.
-1010 ERROR_MSG_RECEIVED
-1011 NON_WHITE_LIST
- This IP cannot access this route.
-1013 ILLEGAL_MESSAGE
-1014 UNKNOWN_ORDER_COMPOSITION
-1015 TOO_MANY_ORDERS
- Too many new orders.
- Too many new orders; current limit is %s orders per %s.
-1016 SERVICE_SHUTTING_DOWN
- This service is no longer available.
-1020 UNSUPPORTED_OPERATION
- This operation is not supported.
-1021 INVALID_TIMESTAMP
- Timestamp for this request is outside of the recvWindow.
- Timestamp for this request was 1000ms ahead of the server’s time.
-1022 INVALID_SIGNATURE
- Signature for this request is not valid.
11xx — Request issues
-1100 ILLEGAL_CHARS
- Illegal characters found in a parameter.
- Illegal characters found in parameter ‘%s’; legal range is ‘%s’.
-1101 TOO_MANY_PARAMETERS
- Too many parameters sent for this endpoint.
- Too many parameters; expected ‘%s’ and received ‘%s’.
- Duplicate values for a parameter detected.
-1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED
- A mandatory parameter was not sent, was empty/null, or malformed.
- Mandatory parameter ‘%s’ was not sent, was empty/null, or malformed.
- Param ‘%s’ or ‘%s’ must be sent, but both were empty/null!
-1103 UNKNOWN_PARAM
-1104 UNREAD_PARAMETERS
- Not all sent parameters were read.
- Not all sent parameters were read; read ‘%s’ parameter(s) but was sent ‘%s’.
-1105 PARAM_EMPTY
- A parameter was empty.
- Parameter ‘%s’ was empty.
-1106 PARAM_NOT_REQUIRED
- A parameter was sent when not required.
- Parameter ‘%s’ sent when not required.
-1108 BAD_ASSET
-1109 BAD_ACCOUNT
-1110 BAD_INSTRUMENT_TYPE
-1111 BAD_PRECISION
- Precision is over the maximum defined for this asset.
-1112 NO_DEPTH
-1113 WITHDRAW_NOT_NEGATIVE
- Withdrawal amount must be negative.
-1114 TIF_NOT_REQUIRED
- TimeInForce parameter sent when not required.
-1115 INVALID_TIF
-1116 INVALID_ORDER_TYPE
-1117 INVALID_SIDE
-1118 EMPTY_NEW_CL_ORD_ID
-1119 EMPTY_ORG_CL_ORD_ID
- Original client order ID was empty.
-1120 BAD_INTERVAL
-1121 BAD_SYMBOL
-1125 INVALID_LISTEN_KEY
-1127 MORE_THAN_XX_HOURS
- Lookup interval is too big.
- More than %s hours between startTime and endTime.
-1128 OPTIONAL_PARAMS_BAD_COMBO
- Combination of optional parameters invalid.
-1130 INVALID_PARAMETER
- Invalid data sent for a parameter.
- Data sent for paramter ‘%s’ is not valid.
-2008 BAD_API_ID
-2010 NEW_ORDER_REJECTED
-2011 CANCEL_REJECTED
-2013 NO_SUCH_ORDER
-2014 BAD_API_KEY_FMT
-2015 REJECTED_MBX_KEY
- Invalid API-key, IP, or permissions for action.
-2016 NO_TRADING_WINDOW
- No trading window could be found for the symbol. Try ticker/24hrs instead.
-4000 INVALID_ORDER_STATUS
-4001 PRICE_LESS_THAN_ZERO
-4002 PRICE_GREATER_THAN_MAX_PRICE
-4003 QTY_LESS_THAN_ZERO
-4004 QTY_LESS_THAN_MIN_QTY
- Quantity less than min quantity.
-4005 QTY_GREATER_THAN_MAX_QTY
- Quantity greater than max quantity.
-4006 STOP_PRICE_LESS_THAN_ZERO
-4006 STOP_PRICE_GREATER_THAN_MAX_PRICE
- Stop price greater than max price.
Messages for -1010 ERROR_MSG_RECEIVED, -2010 NEW_ORDER_REJECTED, and -2011 CANCEL_REJECTED
This code is sent when an error has been returned by the matching engine. The following messages which will indicate the specific error:
Источник