General Info
General API Information
- The following base endpoints are available. Please use whichever works best for your setup:
- 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 Return Codes
- HTTP
4XX
return codes are used for malformed requests; the issue is on the sender’s side. - HTTP
403
return code is used when the WAF Limit (Web Application Firewall) has been violated. - HTTP
409
return code is used when a cancelReplace order partially succeeds. (i.e. if the cancellation of the order fails but the new order placement succeeds.) - 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 receiving429
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.
Error Codes
- Any endpoint can return an ERROR
Sample Payload below:
{
"code": -1121,
"msg": "Invalid symbol."
}
- Specific error codes and messages are defined in Errors Codes.
General Information on Endpoints
- For
GET
endpoints, parameters must be sent as aquery string
. - For
POST
,PUT
, andDELETE
endpoints, the parameters may be sent as aquery string
or in therequest body
with content typeapplication/x-www-form-urlencoded
. - Parameters may be sent in any order.
- If a parameter sent in both the
query string
andrequest body
, thequery string
parameter will be used.
LIMITS
General Info on Limits
- The following
intervalLetter
values for headers:- SECOND => S
- MINUTE => M
- HOUR => H
- DAY => D
intervalNum
describes the amount of the interval. For example,intervalNum
5 withintervalLetter
M means “Every 5 minutes”.- The
/api/v3/exchangeInfo
rateLimits
array contains objects related to the exchange’sRAW_REQUESTS
,REQUEST_WEIGHT
, andORDERS
rate limits. These are further defined in theENUM definitions
section underRate limiters (rateLimitType)
. - A 429 will be returned when either request rate limit or order rate limit is violated.
IP Limits
- Every request will contain
X-MBX-USED-WEIGHT-(intervalNum)(intervalLetter)
in the response headers which has the current used weight for the IP for all request rate limiters defined. - 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 heavierweight
. - When a 429 is received, 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 429s 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 429, to prevent a ban, or, in the case of a 418, until the ban is over. - The limits on the API are based on the IPs, not the API keys.
Order Rate Limits
- Every successful order response will contain a
X-MBX-ORDER-COUNT-(intervalNum)(intervalLetter)
header which has the current order count for the account for all order rate limiters defined. To monitor order count usage, refer toGET api/v3/rateLimit/order
. - When the order count exceeds the limit, you will receive a 429 error without the
Retry-After
header. Please check the Order Rate Limit rules usingGET api/v3/exchangeInfo
and wait for reactivation accordingly. - Rejected/unsuccessful orders are not guaranteed to have
X-MBX-ORDER-COUNT-**
headers in the response. - The order rate limit is counted against each account.
Endpoint security type
- Each endpoint has a security type that determines how you will interact with it. This is stated next to the NAME of the endpoint.
- If no security type is stated, assume the security type is NONE.
- 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. |
TRADE
andUSER_DATA
endpoints areSIGNED
endpoints.
SIGNED (TRADE and USER_DATA) Endpoint security
SIGNED
endpoints require an additional parameter,signature
, to be sent in thequery string
orrequest body
.- Endpoints use
HMAC SHA256
signatures. TheHMAC SHA256 signature
is a keyedHMAC SHA256
operation. Use yoursecretKey
as the key andtotalParams
as the value for the HMAC operation. - The
signature
is not case sensitive. totalParams
is defined as thequery string
concatenated with therequest 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 aftertimestamp
the request is valid for. IfrecvWindow
is not sent, it defaults to 5000. - The logic is as follows:
if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow)
{
// process request
}
else
{
// reject request
}
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.
It is recommended to use a small recvWindow of 5000 or less! The max cannot go beyond 60,000!
SIGNED Endpoint Examples for POST /api/v3/order
HMAC Keys
Here is a step-by-step example of how to send a valid signed payload from the
Linux command line using echo
, openssl
, and curl
.
Key | Value |
---|---|
apiKey |
vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A |
secretKey |
NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j |
Parameter | Value |
---|---|
symbol |
LTCBTC |
side |
BUY |
type |
LIMIT |
timeInForce |
GTC |
quantity |
1 |
price |
0.1 |
recvWindow |
5000 |
timestamp |
1499827319559 |
Example 1: As a request body
- requestBody: symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559
- HMAC SHA256 signature:
[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71
- curl command:
(HMAC SHA256)
[linux]$ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/api/v3/order' -d 'symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'
Example 2: As a query string
- queryString: symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559
- HMAC SHA256 signature:
[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71
- curl command:
(HMAC SHA256)
[linux]$ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/api/v3/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'
Spot Account/Trade
Account Information (USER_DATA)
GET /api/v3/account
Get current account information.
Weight(IP): 10
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"makerCommission": 15,
"takerCommission": 15,
"buyerCommission": 0,
"sellerCommission": 0,
"commissionRates": {
"maker": "0.00150000",
"taker": "0.00150000",
"buyer": "0.00000000",
"seller": "0.00000000"
},
"canTrade": true,
"canWithdraw": true,
"canDeposit": true,
"brokered": false,
"requireSelfTradePrevention": false,
"updateTime": "123456789",
"accountType": "SPOT",
"balances": [
{
"asset": "LTC",
"free": "4763368.68006011",
"locked": "0.00000000"
}
],
"permissions": [
"string"
]
}
Query Order (USER_DATA)
GET /api/v3/order
Check an order’s status.
Weight(IP): 2
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderId | LONG | NO | |
origClientOrderId | STRING | NO | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"orderListId": -1,
"transactTime": "1507725176595",
"price": 2,
"stopPrice": 2,
"origQty": 0,
"executedQty": 0,
"cummulativeQuoteQty": 0,
"origQuoteOrderQty": 0,
"side": "BUY",
"type": "LIMIT",
"timeInForce": "GTC",
"status": "CANCELED",
"icebergQty": 0,
"origClientOrderId": "myOrder1",
"updateTime": "1499827319559",
"time": "1499827319559",
"isWorking": true
}
New Order (TRADE)
POST /api/v3/order
Send in a new order.
Weight(UID): 1 Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
quoteOrderQty | DECIMAL | NO | |
stopPrice | DECIMAL | NO | Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. |
newClientOrderId | STRING | NO | A unique id among open orders. Automatically generated if not sent. |
icebergQty | DECIMAL | NO | Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order. |
orderResponseType | undefined | NO | Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK. |
symbol | STRING | YES | |
side | undefined | NO | |
type | undefined | NO | |
price | DECIMAL | NO | |
quantity | DECIMAL | NO | |
timeInForce | undefined | NO | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"orderListId": -1,
"transactTime": "1507725176595"
}
Cancel Order (TRADE)
DELETE /api/v3/order
Cancel an active order.
Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderId | LONG | NO | |
origClientOrderId | STRING | NO | |
newClientOrderId | STRING | NO | Used to uniquely identify this cancel. Automatically generated by default. |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"orderListId": -1,
"transactTime": "1507725176595",
"price": 2,
"stopPrice": 2,
"origQty": 0,
"executedQty": 0,
"cummulativeQuoteQty": 0,
"origQuoteOrderQty": 0,
"side": "BUY",
"type": "LIMIT",
"timeInForce": "GTC",
"status": "CANCELED"
}
Current Open Orders (USER_DATA)
GET /api/v3/openorders
Get all open orders on a symbol. Careful when accessing this with no symbol.
Weight(IP): 3 for a single symbol; 40 when the symbol parameter is omitted;
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"orderListId": -1,
"transactTime": "1507725176595",
"price": 2,
"stopPrice": 2,
"origQty": 0,
"executedQty": 0,
"cummulativeQuoteQty": 0,
"origQuoteOrderQty": 0,
"side": "BUY",
"type": "LIMIT",
"timeInForce": "GTC",
"status": "CANCELED"
}
]
Cancel all Open Orders on a Symbol (TRADE)
DELETE /api/v3/openorders
Cancels all active orders on a symbol.
This includes OCO orders.
Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"orderListId": -1,
"transactTime": "1507725176595",
"price": 2,
"stopPrice": 2,
"origQty": 0,
"executedQty": 0,
"cummulativeQuoteQty": 0,
"origQuoteOrderQty": 0,
"side": "BUY",
"type": "LIMIT",
"timeInForce": "GTC",
"status": "CANCELED"
}
]
All Orders (USER_DATA)
GET /api/v3/allorders
Get all account orders; active, canceled, or filled.
Weight(IP): 10 with symbol
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderId | LONG | NO | |
limit | INT | NO | Default 500; max 1000. |
startTime | int64 | NO | |
endTime | int64 | NO | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"orderListId": -1,
"transactTime": "1507725176595",
"price": 2,
"stopPrice": 2,
"origQty": 0,
"executedQty": 0,
"cummulativeQuoteQty": 0,
"origQuoteOrderQty": 0,
"side": "BUY",
"type": "LIMIT",
"timeInForce": "GTC",
"status": "CANCELED"
}
]
Query OCO (USER_DATA)
GET /api/v3/orderlist
Retrieves a specific OCO based on provided optional parameters
Weight(IP): 2
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
orderListId | LONG | NO | Either orderListId or origClientOrderId must be provided |
origClientOrderId | STRING | NO | Either orderListId or origClientOrderId must be provided |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"symbol": "BTCUSDT",
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
"transactionTime": "1563417480525",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP"
}
]
}
Cancel OCO (TRADE)
DELETE /api/v3/orderlist
Cancel an entire Order List.
Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderListId | LONG | NO | Either orderListId or listClientOrderId must be provided |
listClientOrderId | STRING | NO | Either orderListId or listClientOrderId must be provided |
newClientOrderId | STRING | NO | Used to uniquely identify this cancel. Automatically generated by default |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"symbol": "BTCUSDT",
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
"transactionTime": "1563417480525",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP"
}
],
"orderReports": [
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"orderListId": -1,
"transactTime": "1507725176595",
"price": 2,
"stopPrice": 2,
"origQty": 0,
"executedQty": 0,
"cummulativeQuoteQty": 0,
"origQuoteOrderQty": 0,
"side": "BUY",
"type": "LIMIT",
"timeInForce": "GTC",
"status": "CANCELED"
}
]
}
Query Open OCO (USER_DATA)
GET /api/v3/openorderlist
Weight(IP): 3
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"symbol": "BTCUSDT",
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
"transactionTime": "1563417480525",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP"
}
]
}
]
Query all OCO (USER_DATA)
GET /api/v3/allorderlist
Retrieves all OCO based on provided optional parameters
Weight(IP): 10
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
fromId | LONG | NO | If supplied, neither startTime or endTime can be provided |
startTime | int64 | NO | |
endTime | int64 | NO | |
limit | INT | NO | Default Value: 500; Max Value: 1000 |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"symbol": "BTCUSDT",
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
"transactionTime": "1563417480525",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP"
}
]
}
]
New OCO (TRADE)
POST /api/v3/order/oco
Send in a new OCO
Weight(UID): 2 Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
stopPrice | DECIMAL | YES | |
limitIcebergQty | DECIMAL | NO | |
stopIcebergQty | DECIMAL | NO | |
stopLimitPrice | DECIMAL | NO | If provided, stopLimitTimeInForce is required. |
limitClientOrderId | STRING | NO | A unique Id for the limit order |
listClientOrderId | STRING | NO | A unique Id for the entire orderList |
stopClientOrderId | STRING | NO | A unique Id for the stop loss/stop loss limit leg |
stopLimitTimeInForce | undefined | NO | Valid values are GTC/FOK/IOC |
orderResponseType | undefined | NO | Set the response JSON. |
trailingDelta | LONG | NO | |
symbol | STRING | YES | |
side | undefined | NO | |
type | undefined | NO | |
price | DECIMAL | NO | |
quantity | DECIMAL | NO | |
timeInForce | undefined | NO | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"symbol": "BTCUSDT",
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
"transactionTime": "1563417480525",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 28,
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP"
}
]
}
Account Trade List (USER_DATA)
GET /api/v3/mytrades
Get trades for a specific account and symbol.
Weight(IP): 10
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderId | LONG | NO | This can only be used in combination with symbol. |
startTime | int64 | NO | |
endTime | int64 | NO | |
fromId | LONG | NO | TradeId to fetch from. Default gets most recent trades. |
limit | INT | NO | Default 500; max 1000. |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"symbol": "BTCUSDT",
"id": 28457,
"orderId": 100234,
"orderListId": -1,
"price": 4.000001,
"qty": 12,
"quoteQty": 48.00001,
"commission": 10.1,
"commissionAsset": "BNB",
"time": "1499865549590",
"isBuyer": true,
"isMaker": false,
"isBestMatch": true
}
]
Create a ListenKey (USER_STREAM)
POST /api/v3/userdatastream
Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
Weight: 1
200 Response
{
"listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1"
}
Wallet Endpoints
Trade Fee (USER_DATA)
GET /sapi/v1/asset/tradefee
Fetch trade fee
Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"symbol": "BTCUSDT",
"makerCommission": 0,
"takerCommission": 0
}
]
Deposit Address (supporting network) (USER_DATA)
GET /sapi/v1/capital/deposit/address
Fetch deposit address with network.
Weight(IP): 10
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
coin | STRING | YES | |
network | STRING | NO | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"address": "1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv",
"coin": "BTC",
"tag": "",
"url": "https://btc.com/1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv"
}
Deposit History (supporting network) (USER_DATA)
GET /sapi/v1/capital/deposit/hisrec
Fetch deposit history.
Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
network | STRING | NO | |
coin | STRING | NO | |
txId | STRING | NO | |
status | undefined | NO | 0(0:pending,6: credited but cannot withdraw, 7=Wrong Deposit,8=Waiting User confirm, 1:success) |
startTime | int64 | NO | Default: 90 days from current timestamp |
endTime | int64 | NO | Default: present timestamp |
offset | INT | NO | Default:0 |
limit | INT | NO | Default:1000, Max:1000 |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"id": "769800519366885376",
"amount": "0.001",
"coin": "BNB",
"network": "BNB",
"status": 0,
"address": "bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23",
"addressTag": "101764890",
"txId": "98A3EA560C6B3336D348B6C83F0F95ECE4F1F5919E94BD006E5BF3BF264FACFC",
"insertTime": "1661493146000",
"transferType": 0,
"confirmTimes": "1/1",
"unlockConfirm": 0,
"walletType": 0
}
]
Withdraw History (supporting network) (USER_DATA)
GET /sapi/v1/capital/withdraw/history
Fetch withdraw history.
Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
coin | STRING | NO | |
withdrawOrderId | STRING | NO | |
status | undefined | NO | 0(0:Email Sent,1:Cancelled 2:Awaiting Approval 3:Rejected 4:Processing 5:Failure 6:Completed) |
offset | INT | NO | |
limit | INT | NO | Default: 1000, Max: 1000 |
startTime | int64 | NO | Default: 90 days from current timestamp |
endTime | int64 | NO | Default: present timestamp |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"id": "b6ae22b3aa844210a7041aee7589627c",
"amount": "8.91000000",
"transactionFee": "0.004",
"coin": "USDT",
"status": 6,
"address": "0x94df8b352de7f46f64b01d3666bf6e936e44ce60",
"txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268",
"applyTime": "2019-10-12 11:12:02",
"network": "ETH",
"transferType": 0,
"info": "The address is not valid. Please confirm with the recipient",
"confirmNo": 3,
"walletType": 1,
"txKey": "",
"completeTime": "2023-03-23 16:52:41",
"withdrawOrderId": "WITHDRAWtest123"
}
]
Withdraw(USER_DATA)
POST /sapi/v1/capital/withdraw/apply
Submit a withdraw request.
Weight(IP): 10
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
coin | STRING | YES | |
network | STRING | NO | |
address | STRING | YES | |
addressTag | STRING | NO | Secondary address identifier for coins like XRP,XMR etc. |
amount | DECIMAL | YES | |
withdrawOrderId | STRING | NO | client id for withdraw |
transactionFeeFlag | undefined | NO | When making internal transfer, true for returning the fee to the destination account; false for returning the fee back to the departure account. Default false. |
name | STRING | NO | Description of the address. Space in name should be encoded into %20. |
walletType | INT | NO | The wallet type for withdraw,0-spot wallet ,1-funding wallet. Default walletType is the current “selected wallet” under wallet->Fiat and Spot/Funding->Deposit |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"id": 0
}
All Coins’ Information (USER_DATA)
GET /sapi/v1/capital/config/getall
Get information of coins (available for deposit and withdraw) for user.
Weight(IP): 10
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"coin": "BTC",
"depositAllEnable": true,
"free": 0.08074558,
"freeze": 0,
"ipoable": 0,
"ipoing": 0,
"isLegalMoney": false,
"locked": 0,
"storage": 0,
"trading": false,
"withdrawAllEnable": false,
"name": "Bitcoin",
"withdrawing": 0,
"networkList": [
{
"addressRegex": "^(bnb1)[0-9a-z]{38}$",
"coin": "BTC",
"depositDesc": "Wallet Maintenance, Deposit Suspended",
"depositEnable": false,
"isDefault": false,
"memoRegex": "^[0-9A-Za-z\\-_]{1,120}$",
"minConfirm": 1,
"name": "BEP2",
"network": "BNB",
"resetAddressStatus": false,
"specialTips": "Both a MEMO and an Address are required to successfully deposit your BEP2-BTCB tokens to Hitobit.",
"unlockConfirm": 0,
"withdrawDesc": "Wallet Maintenance, Withdrawal Suspended",
"withdrawEnable": false,
"withdrawFee": 0.0000022,
"withdrawIntegerMultiple": 1e-8,
"withdrawMax": 10000000000,
"withdrawMin": 0.0000044,
"sameAddress": true,
"estimatedArrivalTime": 25,
"busy": false
}
]
}
]
Market Data Endpoints
Order Book
GET /api/v3/depth
Weight(IP):
Limit | Weight |
---|---|
1-100 | 1 |
101-500 | 5 |
501-1000 | 10 |
1001-5000 | 50 |
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
limit | INT | NO | Default 100; max 5000.If limit > 5000, then the response will truncate to 5000. |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"s": "BTC",
"T": "1565246363776",
"U": 1027024,
"lastUpdateId": 1027024,
"pu": 1027024,
"bids": [
{
"price": 4,
"quantity": 431
}
],
"asks": [
{
"price": 4,
"quantity": 431
}
]
}
24hr Ticker Price Change Statistics
GET /api/v3/ticker/24hr
24 hour rolling window price change statistics. Careful when accessing this with no symbol.
Weight(IP):
Parameter | Symbols Provided | Weight |
---|---|---|
symbol | 1 | 1 |
symbol parameter is omitted | 40 | |
symbols | 1 - 20 | 1 |
21 - 100 | 20 | |
101 or more | 40 | |
symbols parameter is omitted | 40 |
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO | Parameter symbol and symbols cannot be used in combination. |
symbols | undefined | NO | Examples of accepted format for the symbols parameter: [“BTCUSDT”,“BNBUSDT”] |
type | undefined | NO | Supported values: FULL or MINI. |
Detailed descriptions
symbol: Parameter symbol and symbols cannot be used in combination. If neither parameter is sent, prices for all symbols will be returned in an array.
symbols: Examples of accepted format for the symbols parameter: [“BTCUSDT”,“BNBUSDT”] or %5B%22BTCUSDT%22,%22BNBUSDT%22%5D
type: Supported values: FULL or MINI. If none provided, the default is FULL
Symbol Price Ticker
GET /api/v3/ticker/price
Latest price for a symbol or symbols.
Weight(IP):
Parameter | Symbols Provided | Weight |
---|---|---|
symbol | 1 | 1 |
symbol parameter is omitted | 2 | |
symbols | Any | 2 |
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO | Parameter symbol and symbols cannot be used in combination. |
symbols | undefined | NO | Examples of accepted format for the symbols parameter: [“BTCUSDT”,“BNBUSDT”] |
Detailed descriptions
symbol: Parameter symbol and symbols cannot be used in combination. If neither parameter is sent, prices for all symbols will be returned in an array.
symbols: Examples of accepted format for the symbols parameter: [“BTCUSDT”,“BNBUSDT”] or %5B%22BTCUSDT%22,%22BNBUSDT%22%5D
200 Response
{
"symbol": "BTCUSDT",
"Price": 4.000002
}
Kline/Candlestick Data
GET /api/v3/klines
Kline/candlestick bars for a symbol.
Klines are uniquely identified by their open time.
Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
interval | undefined | YES | |
limit | INT | NO | Default 500; max 1000. |
startTime | int64 | NO | |
endTime | int64 | NO | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"openTime": "1499040000000",
"open": 0.0163479,
"high": 0.8,
"low": 0.015758,
"close": 0.015771,
"baseVolume": 148976.11,
"closeTime": "1499644799999",
"quoteVolume": 2434.1907,
"tradeCount": 308,
"takerBuyBaseVolume": 1756.874,
"takerBuyQuoteVolume": 28.466944,
"ignore": 0
}
]
Recent Trades List
GET /api/v3/trades
Get recent trades.
Weight(IP): 1
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
limit | INT | NO | Default 500; max 1000. |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
[
{
"id": 28457,
"Price": 4.000001,
"BaseQuantity": 12,
"QuoteQuantity": 48.00001,
"Time": "1499865549590",
"isBuyerMaker": true,
"IsBestMatch": true
}
]
Exchange Information
GET /api/v3/exchangeinfo
Current exchange trading rules and symbol information
Weight(IP): 10
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO | |
symbols | undefined | NO | |
recvWindow | INT | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES |
200 Response
{
"timeZone": "UTC",
"serverTime": "1565246363776",
"rateLimits": [
{
"Interval": "MINUTE",
"rateLimitType": "REQUEST_WEIGHT",
"intervalNum": 1,
"Limit": 1200
}
],
"symbols": [
{
"symbol": "ETHBTC",
"status": "TRADING",
"baseAsset": "ETH",
"baseAssetPrecision": 8,
"quoteAsset": "BTC",
"quotePrecision": 8,
"orderTypes": [
"LIMIT"
],
"iceBergAllowed": true,
"isSpotTradingAllowed": true,
"isMarginTradingAllowed": true,
"ocoAllowed": true,
"quoteOrderQtyMarketAllowed": true,
"baseCommissionPrecision": 1,
"quoteCommissionPrecision": 1,
"permissions": [
"SPOT"
],
"filters": [
{
"filterType": "UNKNOWN"
}
],
"defaultSelfTradePreventionMode": "NONE",
"allowedSelfTradePreventionModes": [
null
],
"allowTrailingStop": false,
"cancelReplaceAllowed": false
}
],
"exchangeFilters": [
null
]
}
Test Connectivity
GET /api/v3/ping
Test connectivity to the Rest API.
Weight(IP): 1
Check Server Time
GET /api/v3/time
Test connectivity to the Rest API and get the current server time.
Weight(IP): 1
200 Response
{
"serverTime": 0
}
General WSS information
- The base endpoint is: wss://stream.hitobit.com:443
- streams are accessed at /stream?streams=<streamName1>/<streamName2>/<streamName3>
- stream events are wrapped as follows: {“stream”:“<streamName>”,“data”:<rawPayload>}
- All symbols for streams are lowercase
- A single connection to stream.hitobit.com is only valid for 24 hours; expect to be disconnected at the 24 hour mark
- The websocket server will send a
ping frame
every 3 minutes. If the websocket server does not receive apong frame
back from the connection within a 10 minute period, the connection will be disconnected. Unsolicitedpong frames
are allowed.
Websocket Limits
- WebSocket connections have a limit of 5 incoming messages per second. A message is considered:
- A PING frame
- A PONG frame
- A JSON controlled message (e.g. subscribe, unsubscribe)
- A connection that goes beyond the limit will be disconnected; IPs that are repeatedly disconnected may be banned.
- A single connection can listen to a maximum of 1024 streams.
- There is a limit of 300 connections per attempt every 5 minutes per IP.
Live Subscribing/Unsubscribing to streams
- The following data can be sent through the websocket instance in order to subscribe/unsubscribe from streams. Examples can be seen below.
- The
id
used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth. - In the response, if the
result
received isnull
this means the request sent was a success for non-query requests (e.g. Subscribing/Unsubscribing).
Subscribe to a stream
- Request
{
"method": "SUBSCRIBE",
"params": [
"btcusdt@aggTrade",
"btcusdt@depth"
],
"id": 1
}
- Response
{
"result": null,
"id": 1
}
Unsubscribe to a stream
- Request
{
"method": "UNSUBSCRIBE",
"params": [
"btcusdt@depth"
],
"id": 312
}
- Response
{
"result": null,
"id": 312
}
Listing Subscriptions
- Request
{
"method": "LIST_SUBSCRIPTIONS",
"id": 3
}
- Response
{
"result": [
"btcusdt@aggTrade"
],
"id": 3
}
Error Messages
Error Message | Description |
---|---|
{“code”: 0, “msg”: “Unknown property”,“id”: %s} | Parameter used in the SET_PROPERTY or GET_PROPERTY was invalid |
{“code”: 1, “msg”: “Invalid value type: expected Boolean”} | Value should only be true or false |
{“code”: 2, “msg”: “Invalid request: property name must be a string”} | Property name provided was invalid |
{“code”: 2, “msg”: “Invalid request: request ID must be an unsigned integer”} | Parameter id had to be provided or the value provided in the id parameter is an unsupported type |
{“code”: 2, “msg”: “Invalid request: unknown variant %s, expected one of SUBSCRIBE , UNSUBSCRIBE , LIST_SUBSCRIPTIONS , SET_PROPERTY , GET_PROPERTY at line 1 column 28”} |
Possible typo in the provided method or provided method was neither of the expected values |
{“code”: 2, “msg”: “Invalid request: too many parameters”} | Unnecessary parameters provided in the data |
{“code”: 2, “msg”: “Invalid request: property name must be a string”} | Property name was not provided |
{“code”: 2, “msg”: “Invalid request: missing field method at line 1 column 73”} |
method was not provided in the data |
{“code”:3,“msg”:“Invalid JSON: expected value at line %s column %s”} | JSON data sent has incorrect syntax. |
Detailed Stream information
Aggregate Trade Streams
The Aggregate Trade Streams push trade information that is aggregated for a single taker order.
Stream Name: <symbol>@aggTrade
Update Speed: Real-time
Payload:
{
"e": "aggTrade", // Event type
"E": 1672515782136, // Event time
"s": "BNBBTC", // Symbol
"a": 12345, // Aggregate trade ID
"p": "0.001", // Price
"q": "100", // Quantity
"f": 100, // First trade ID
"l": 105, // Last trade ID
"T": 1672515782136, // Trade time
"m": true, // Is the buyer the market maker?
"M": true // Ignore
}
Trade Streams
The Trade Streams push raw trade information; each trade has a unique buyer and seller.
Stream Name: <symbol>@trade
Update Speed: Real-time
Payload:
{
"e": "trade", // Event type
"E": 1672515782136, // Event time
"s": "BNBBTC", // Symbol
"t": 12345, // Trade ID
"p": "0.001", // Price
"q": "100", // Quantity
"b": 88, // Buyer order ID
"a": 50, // Seller order ID
"T": 1672515782136, // Trade time
"m": true, // Is the buyer the market maker?
"M": true // Ignore
}
Kline/Candlestick Streams
The Kline/Candlestick Stream push updates to the current klines/candlestick every second.
Kline/Candlestick chart intervals:
s-> seconds; m -> minutes; h -> hours; d -> days; w -> weeks; M -> months
- 1s
- 1m
- 3m
- 5m
- 15m
- 30m
- 1h
- 2h
- 4h
- 6h
- 8h
- 12h
- 1d
- 3d
- 1w
- 1M
Stream Name: <symbol>@kline_<interval>
Update Speed: 1000ms for 1s
, 2000ms for the other intervals
Payload:
{
"e": "kline", // Event type
"E": 1672515782136, // Event time
"s": "BNBBTC", // Symbol
"k": {
"t": 1672515780000, // Kline start time
"T": 1672515839999, // Kline close time
"s": "BNBBTC", // Symbol
"i": "1m", // Interval
"f": 100, // First trade ID
"L": 200, // Last trade ID
"o": "0.0010", // Open price
"c": "0.0020", // Close price
"h": "0.0025", // High price
"l": "0.0015", // Low price
"v": "1000", // Base asset volume
"n": 100, // Number of trades
"x": false, // Is this kline closed?
"q": "1.0000", // Quote asset volume
"V": "500", // Taker buy base asset volume
"Q": "0.500", // Taker buy quote asset volume
"B": "123456" // Ignore
}
}
Individual Symbol Mini Ticker Stream
24hr rolling window mini-ticker statistics. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs.
Stream Name: <symbol>@miniTicker
Update Speed: 1000ms
Payload:
{
"e": "24hrMiniTicker", // Event type
"E": 1672515782136, // Event time
"s": "BNBBTC", // Symbol
"c": "0.0025", // Close price
"o": "0.0010", // Open price
"h": "0.0025", // High price
"l": "0.0010", // Low price
"v": "10000", // Total traded base asset volume
"q": "18" // Total traded quote asset volume
}
All Market Mini Tickers Stream
24hr rolling window mini-ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array.
Stream Name: !miniTicker@arr
Update Speed: 1000ms
Payload:
[
{
// Same as <symbol>@miniTicker payload
}
]
Individual Symbol Ticker Streams
24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs.
Stream Name: <symbol>@ticker
Update Speed: 1000ms
Payload:
{
"e": "24hrTicker", // Event type
"E": 1672515782136, // Event time
"s": "BNBBTC", // Symbol
"p": "0.0015", // Price change
"P": "250.00", // Price change percent
"w": "0.0018", // Weighted average price
"x": "0.0009", // First trade(F)-1 price (first trade before the 24hr rolling window)
"c": "0.0025", // Last price
"Q": "10", // Last quantity
"b": "0.0024", // Best bid price
"B": "10", // Best bid quantity
"a": "0.0026", // Best ask price
"A": "100", // Best ask quantity
"o": "0.0010", // Open price
"h": "0.0025", // High price
"l": "0.0010", // Low price
"v": "10000", // Total traded base asset volume
"q": "18", // Total traded quote asset volume
"O": 0, // Statistics open time
"C": 86400000, // Statistics close time
"F": 0, // First trade ID
"L": 18150, // Last trade Id
"n": 18151 // Total number of trades
}
All Market Tickers Stream
24hr rolling window ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array.
Stream Name: !ticker@arr
Update Speed: 1000ms
Payload:
[
{
// Same as <symbol>@ticker payload
}
]
Individual Symbol Book Ticker Streams
Pushes any update to the best bid or ask’s price or quantity in real-time for a specified symbol.
Multiple <symbol>@bookTicker
streams can be subscribed to over one connection.
Stream Name: <symbol>@bookTicker
Update Speed: Real-time
Payload:
{
"u":400900217, // order book updateId
"s":"BNBUSDT", // symbol
"b":"25.35190000", // best bid price
"B":"31.21000000", // best bid qty
"a":"25.36520000", // best ask price
"A":"40.66000000" // best ask qty
}
Diff. Depth Stream
Order book price and quantity depth updates used to locally manage an order book.
Stream Name: <symbol>@depth OR <symbol>@depth@100ms
Update Speed: 1000ms or 100ms
Payload:
{
"e": "depthUpdate", // Event type
"E": 1672515782136, // Event time
"s": "BNBBTC", // Symbol
"U": 157, // First update ID in event
"u": 160, // Final update ID in event
"b": [ // Bids to be updated
[
"0.0024", // Price level to be updated
"10" // Quantity
]
],
"a": [ // Asks to be updated
[
"0.0026", // Price level to be updated
"100" // Quantity
]
]
}
How to manage a local order book correctly
- Open a stream to wss://stream.hitobit.com:443/stream?streams=bnbbtc@depth.
- Buffer the events you receive from the stream.
- Get a depth snapshot from https://api.hitobit.com/api/v3/depth?symbol=BNBBTC&limit=1000 .
- Drop any event where
u
is <=lastUpdateId
in the snapshot. - The first processed event should have
U
<=lastUpdateId
+1 ANDu
>=lastUpdateId
+1. - While listening to the stream, each new event’s
U
should be equal to the previous event’su
+1. - 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.
Note: Due to depth snapshots having a limit on the number of price levels, a price level outside of the initial snapshot that doesn’t have a quantity change won’t have an update in the Diff. Depth Stream. Consequently, those price levels will not be visible in the local order book even when applying all updates from the Diff. Depth Stream correctly and cause the local order book to have some slight differences with the real order book. However, for most use cases the depth limit of 5000 is enough to understand the market and trade effectively.
Error codes
Errors consist of two parts: an error code and a message. Codes are universal, but messages can vary. Here is the error JSON payload:
{
"code":-1121,
"msg":"Invalid symbol."
}
10xx - General Server or Network issues
-1000 UNKNOWN
- An unknown error occurred 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 much request weight used; current limit is %s request weight per %s. Please use WebSocket Streams for live updates to avoid polling the API.
- Way too much request weight used; IP banned until %s. Please use WebSocket Streams for live updates to avoid bans.
-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.
-1008 SERVER_BUSY
- Server is currently overloaded with other requests. Please try again in a few minutes.
-1014 UNKNOWN_ORDER_COMPOSITION
- Unsupported order combination.
-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
- An unknown parameter was sent.
-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 PARAM_OVERFLOW
- Parameter ‘%s’ overflowed.
-1111 BAD_PRECISION
- Precision is over the maximum defined for this asset.
-1112 NO_DEPTH
- No orders on book for symbol.
-1114 TIF_NOT_REQUIRED
- TimeInForce parameter sent when not required.
-1115 INVALID_TIF
- Invalid timeInForce.
-1116 INVALID_ORDER_TYPE
- Invalid orderType.
-1117 INVALID_SIDE
- Invalid side.
-1118 EMPTY_NEW_CL_ORD_ID
- New client order ID was empty.
-1119 EMPTY_ORG_CL_ORD_ID
- Original client order ID was empty.
-1120 BAD_INTERVAL
- Invalid interval.
-1121 BAD_SYMBOL
- Invalid symbol.
-1125 INVALID_LISTEN_KEY
- This listenKey does not exist.
-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 parameter ‘%s’ is not valid.
-1134 BAD_STRATEGY_TYPE
strategyType
was less than 1000000.
-1135 INVALID_JSON
- Invalid JSON Request
- JSON sent for parameter ‘%s’ is not valid
-1145 INVALID_CANCEL_RESTRICTIONS
cancelRestrictions
has to be eitherONLY_NEW
orONLY_PARTIALLY_FILLED
.
-1151 DUPLICATE_SYMBOLS
- Symbol is present multiple times in the list.
-2010 NEW_ORDER_REJECTED
- NEW_ORDER_REJECTED
-2011 CANCEL_REJECTED
- CANCEL_REJECTED
-2013 NO_SUCH_ORDER
- Order does not exist.
-2014 BAD_API_KEY_FMT
- API-key format invalid.
-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.
-2026 ORDER_ARCHIVED
- Order was canceled or expired with no executed qty over 90 days ago and has been archived.
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:
Error message | Description |
---|---|
“Unknown order sent.” | The order (by either orderId , clOrdId , origClOrdId ) could not be found |
“Duplicate order sent.” | The clOrdId is already in use. |
“Market is closed.” | The symbol is not trading. |
“Account has insufficient balance for requested action.” | Not enough funds to complete the action. |
“Market orders are not supported for this symbol.” | MARKET is not enabled on the symbol. |
“Iceberg orders are not supported for this symbol.” | icebergQty is not enabled on the symbol. |
“Stop loss orders are not supported for this symbol.” | STOP_LOSS is not enabled on the symbol. |
“Stop loss limit orders are not supported for this symbol.” | STOP_LOSS_LIMIT is not enabled on the symbol. |
“Take profit orders are not supported for this symbol.” | TAKE_PROFIT is not enabled on the symbol. |
“Take profit limit orders are not supported for this symbol.” | TAKE_PROFIT_LIMIT is not enabled on the symbol. |
“Price * QTY is zero or less.” | price * quantity is too low. |
“IcebergQty exceeds QTY.” | icebergQty must be less than the order quantity. |
“This action is disabled on this account.” | Contact customer support; some actions have been disabled on the account. |
“This account may not place or cancel orders.” | Contact customer support; the account has trading ability disabled. |
“Unsupported order combination” | The orderType , timeInForce , stopPrice , and/or icebergQty combination isn’t allowed. |
“Order would trigger immediately.” | The order’s stop price is not valid when compared to the last traded price. |
“Cancel order is invalid. Check origClOrdId and orderId.” | No origClOrdId or orderId was sent in. |
“Order would immediately match and take.” | LIMIT_MAKER order type would immediately match and trade, and not be a pure maker order. |
“The relationship of the prices for the orders is not correct.” | The prices set in the OCO is breaking the Price rules. The rules are: SELL Orders : Limit Price > Last Price > Stop Price BUY Orders : Limit Price < Last Price < Stop Price |
“OCO orders are not supported for this symbol” | OCO is not enabled on the symbol. |
“Quote order qty market orders are not support for this symbol.” | MARKET orders using the parameter quoteOrderQty are not enabled on the symbol. |
“Trailing stop orders are not supported for this symbol.” | Orders using trailingDelta are not enabled on the symbol. |
“Order cancel-replace is not supported for this symbol.” | POST /api/v3/order/cancelReplace is not enabled for the symbol. |
“This symbol is not permitted for this account.” | Account does not have permission to trade on this symbol. |
“This symbol is restricted for this account.” | Account does not have permission to trade on this symbol. |
“Order was not canceled due to cancel restrictions.” | Either cancelRestrictions was set to ONLY_NEW but the order status was not NEW or cancelRestrictions was set to ONLY_PARTIALLY_FILLED but the order status was not PARTIALLY_FILLED . |
Errors regarding POST /api/v3/order/cancelReplace
-2021 Order cancel-replace partially failed
This code is sent when either the cancellation of the order failed or the new order placement failed but not both.
-2022 Order cancel-replace failed.
This code is sent when both the cancellation of the order failed and the new order placement failed.
Filter failures
Error message | Description |
---|---|
“Filter failure: PRICE_FILTER” | price is too high, too low, and/or not following the tick size rule for the symbol. |
“Filter failure: PERCENT_PRICE” | price is X% too high or X% too low from the average weighted price over the last Y minutes. |
“Filter failure: LOT_SIZE” | quantity is too high, too low, and/or not following the step size rule for the symbol. |
“Filter failure: MIN_NOTIONAL” | price * quantity is too low to be a valid order for the symbol. |
“Filter failure: ICEBERG_PARTS” | ICEBERG order would break into too many parts; icebergQty is too small. |
“Filter failure: MARKET_LOT_SIZE” | MARKET order’s quantity is too high, too low, and/or not following the step size rule for the symbol. |
“Filter failure: MAX_POSITION” | The account’s position has reached the maximum defined limit. This is composed of the sum of the balance of the base asset, and the sum of the quantity of all open BUY orders. |
“Filter failure: MAX_NUM_ORDERS” | Account has too many open orders on the symbol. |
“Filter failure: MAX_NUM_ALGO_ORDERS” | Account has too many open stop loss and/or take profit orders on the symbol. |
“Filter failure: MAX_NUM_ICEBERG_ORDERS” | Account has too many open iceberg orders on the symbol. |
“Filter failure: TRAILING_DELTA” | trailingDelta is not within the defined range of the filter for that order type. |
“Filter failure: EXCHANGE_MAX_NUM_ORDERS” | Account has too many open orders on the exchange. |
“Filter failure: EXCHANGE_MAX_NUM_ALGO_ORDERS” | Account has too many open stop loss and/or take profit orders on the exchange. |
“Filter failure: EXCHANGE_MAX_NUM_ICEBERG_ORDERS” | Account has too many open iceberg orders on the exchange. |