Navbar
简体中文

Change Log


General Info

General API Information

HTTP Return Codes

Error Codes

The error payload is as follows:

{
  "code": -1121,
  "msg": "Invalid symbol."
}

General Information on Endpoints

LIMITS

IP Limits

Order Rate Limits

Endpoint Security Type

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.

SIGNED (TRADE and USER_DATA) Endpoint Security

Timing security

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.

SIGNED Endpoint Examples for POST /dapi/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 dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83
secretKey 2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9
Parameter Value
symbol BTCUSD_200925
side BUY
type LIMIT
timeInForce GTC
quantity 1
price 9000
recvWindow 5000
timestamp 1591702613943

Example 1: As a query string

Example 1

HMAC SHA256 signature:

    $ echo -n "symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000&timestamp=1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9"
    (stdin)= 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a

curl command:

    (HMAC SHA256)
    $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://testnet.binancefuture.com/dapi/v1/order?symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000&timestamp=1591702613943&signature= 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a'

Example 2: As a request body

Example 2

HMAC SHA256 signature:

    $ echo -n "symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000&timestamp=1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9"
    (stdin)= 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a

curl command:

    (HMAC SHA256)
    $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://testnet.binancefuture.com/dapi/v1/order' -d 'symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000&timestamp=1591702613943&signature= 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a'

Example 3: Mixed query string and request body

Example 3

HMAC SHA256 signature:

    $ echo -n "symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000&timestamp=1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9"
    (stdin)= 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a

curl command:

    (HMAC SHA256)
    $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://testnet.binancefuture.com/dapi/v1/order?symbol=BTCUSD_200925&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=9000&recvWindow=5000&timestamp=1591702613943&signature=21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a'

27319559

Note that the signature is different in example 3.
There is no & between "GTC" and "quantity=1".

Public Endpoints Info

Terminology

ENUM definitions

Symbol type:

Contract type:

Contract status:

Order status (status):

Order types (orderTypes, type):

Order side (side):

Position side (positionSide):

Time in force (timeInForce):

Working Type (workingType)

Response Type (newOrderRespType)

Kline/Candlestick chart intervals:

m -> minutes; h -> hours; d -> days; w -> weeks; M -> months

Rate limiters (rateLimitType)

REQUEST_WEIGHT

  {
    "rateLimitType": "REQUEST_WEIGHT",
    "interval": "MINUTE",
    "intervalNum": 1,
    "limit": 6000
  }

ORDERS

  {
    "rateLimitType": "ORDERS",
    "interval": "MINUTE",
    "intervalNum": 1,
    "limit": 1200
   }

Rate limit intervals (interval)

Filters

Filters define trading rules on a symbol or an exchange.

Symbol filters

PRICE_FILTER

/exchangeInfo format:

  {
    "filterType": "PRICE_FILTER",
    "minPrice": "0.00000100",
    "maxPrice": "100000.00000000",
    "tickSize": "0.00000100"
  }

The PRICE_FILTER defines the price rules for a symbol. There are 3 parts:

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:

LOT_SIZE

/exchangeInfo format:

  {
    "filterType": "LOT_SIZE",
    "minQty": "0.00100000",
    "maxQty": "100000.00000000",
    "stepSize": "0.00100000"
  }

The LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for a symbol. There are 3 parts:

In order to pass the lot size, the following must be true for quantity:

MARKET_LOT_SIZE

/exchangeInfo format:

  {
    "filterType": "MARKET_LOT_SIZE",
    "minQty": "0.00100000",
    "maxQty": "100000.00000000",
    "stepSize": "0.00100000"
  }

The MARKET_LOT_SIZE filter defines the quantity (aka "lots" in auction terms) rules for MARKET orders on a symbol. There are 3 parts:

In order to pass the market lot size, the following must be true for quantity:

MAX_NUM_ORDERS

/exchangeInfo format:

  {
    "filterType": "MAX_NUM_ORDERS",
    "limit": 25
  }

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

ExchangeInfo format:

  {
    "filterType": "PERCENT_PRICE",
    "multiplierUp": "1.1500",
    "multiplierDown": "0.8500",
    "multiplierDecimal": 4
  }

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:

Market Data Endpoints

Test Connectivity

Response:

{}

GET /dapi/v1/ping

Test connectivity to the Rest API.

Weight: 1

Parameters: NONE

Check Server time

Response:

{
  "serverTime": 1499827319559
}

GET /dapi/v1/time

Test connectivity to the Rest API and get the current server time.

Weight: 1

Parameters: NONE

Exchange Information

Response:

{
    "exchangeFilters": [],
    "rateLimits": [ 
        {
            "interval": "MINUTE", 
            "intervalNum": 1, 
            "limit": 6000, 
            "rateLimitType": "REQUEST_WEIGHT" 
        },
        {
            "interval": "MINUTE",
            "intervalNum": 1,
            "limit": 6000,
            "rateLimitType": "ORDERS"
        }
    ],
    "serverTime": 1565613908500,
    "symbols": [ // contract symbols
        {
            "filters": [
                {
                    "filterType": "PRICE_FILTER", 
                    "maxPrice": "10000000", 
                    "minPrice": "0.00000100", 
                    "tickSize": "0.00000100" 
                },
                {
                    "filterType": "LOT_SIZE", 
                    "maxQty": "10000000", 
                    "minQty": "0.00100000", 
                    "stepSize": "0.00100000" 
                },
                {
                    "filterType": "MARKET_LOT_SIZE", 
                    "maxQty": "10000000", 
                    "minQty": "0.00100000", 
                    "stepSize": "0.00100000" 
                },
                {
                    "filterType": "MAX_NUM_ORDERS", 
                    "limit": 100
                },
                {
                    "filterType": "PERCENT_PRICE", 
                    "multiplierUp": "1.1500", 
                    "multiplierDown": "0.8500", 
                    "multiplierDecimal": 4
                }
            ],
            "OrderType": [ 
                "LIMIT", 
                "MARKET", 
                "STOP",
                "TAKE_PROFIT",
                "TRAILING_STOP_MARKET"
            ],
            "timeInForce": [
                "GTC",
                "IOC",
                "FOK",
                "GTX"
            ],
            "symbol": "BTCUSD_200925", // contract symbol name
            "pair": "BTCUSD",  // underlying symbol
            "contractType": "CURRENT_QUARTER", 
            "deliveryDate": 1601020800000,
            "onboardDate": 1590739200000,
            "contractStatus": "TRADING", 
            "contractSize": 100,    
            "quoteAsset": "USD",
            "baseAsset": "BTC",   
            "marginAsset": "BTC",
            "pricePrecision": 2,
            "quantityPrecision": 0,
            "baseAssetPrecision": 8,
            "quotePrecision": 8,
            "maintMarginPercent": "2.5000",
            "requiredMarginPercent": "5.0000"
        }
    ],
    "timezone": "UTC"
}

GET /dapi/v1/exchangeInfo

Current exchange trading rules and symbol information

Weight: 1

Parameters: NONE

Order Book

Response:

{
  "lastUpdateId": 16769853,
  "E": 1591250106370,   // Message output time
  "T": 1591250106368,   // Transaction time
  "bids": [
    [
      "9638.0",         // PRICE
      "431"             // QTY
    ]
  ],
  "asks": [
    [
      "9638.2",
      "12"
    ]
  ]
}

GET /dapi/v1/depth

Weight:

Adjusted based on the limit:

Limit Weight
5, 10, 20, 50 2
100 5
500 10
1000 20

Parameters:

Name Type Mandatory Description
symbol STRING YES
limit INT NO Default 500; Valid limits:[5, 10, 20, 50, 100, 500, 1000]

Recent Trades List

Response:

[
  {
    "id": 28457,
    "price": "9635.0",
    "qty": "1",
    "baseQty": "0.01037883",
    "time": 1591250192508,
    "isBuyerMaker": true,
  }
]

GET /dapi/v1/trades

Get recent trades (up to last 24h) Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
limit INT NO Default 500; max 1000.

Old Trades Lookup (MARKET_DATA)

Response:

[
  {
    "id": 595103,
    "price": "9642.2",
    "qty": "1",
    "baseQty": "0.01037108",
    "time": 1499865549590,
    "isBuyerMaker": true,
  }
]

GET /dapi/v1/historicalTrades

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.

Compressed/Aggregate Trades List

Response:

[
  {
    "a": 416690,            // Aggregate tradeId
    "p": "9642.4",          // Price
    "q": "3",               // Quantity
    "f": 595259,            // First tradeId
    "l": 595259,            // Last tradeId
    "T": 1591250548649,     // Timestamp
    "m": false,             // Was the buyer the maker?
  }
]

GET /dapi/v1/aggTrades

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.

Index Price and Mark Price

Response:

[
    {
        "symbol": "BTCUSD_200925",      
        "pair": "BTCUSD",               
        "indexPrice": "9638.76160000",  
        "markPrice": "9637.73796667",   
        "estimatedSettlePrice": "9642.19809219",  // Estimated Settle Price, only useful in the last hour before the settlement starts.
        "time": 1591250656000           
    }
]

GET /dapi/v1/premiumIndex

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING NO
pair STRING NO

Kline/Candlestick Data

Response:

[
  [
    1591258320000,          // Open time
    "9640.7",               // Open
    "9642.4",               // High
    "9640.6",               // Low
    "9642.0",               // Close (or latest price)
    "206",                  // Volume
    1591258379999,          // Close time
    "2.13660389",           // Base asset volume
    48,                     // Number of trades
    "119",                  // Taker buy volume
    "1.23424865",           // Taker buy base asset volume
    "0"                         // Ignore.
  ]
]

GET /dapi/v1/klines

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.

Continues Contract Kline/Candlestick Data

Response:

[
  [
    1591258320000,          // Open time
    "9640.7",               // Open
    "9642.4",               // High
    "9640.6",               // Low
    "9642.0",               // Close (or latest price)
    "206",                  // Volume
    1591258379999,          // Close time
    "2.13660389",           // Base asset volume
    48,                     // Number of trades
    "119",                  // Taker buy volume
    "1.23424865",           // Taker buy base asset volume
    "0"                         // Ignore.
  ]
]

GET /dapi/v1/continuousKlines

Kline/candlestick bars for a specific contract type.

Klines are uniquely identified by their open time.

Weight: 1

Parameters:

Name Type Mandatory Description
pair STRING YES
contractType ENUM YES
interval ENUM YES
startTime LONG NO
endTime LONG NO
limit INT NO Default 500; max 1500.

Index Price Kline/Candlestick Data

Response:

[
  [
    1591256400000,          // Open time
    "9653.69440000",        // Open
    "9653.69640000",        // High
    "9651.38600000",        // Low
    "9651.55200000",        // Close (or latest price)
    "0  ",                  // Ignore
    1591256459999,          // Close time
    "0",                    // Ignore
    60,                     // Number of bisic data
    "0",                    // Ignore
    "0",                    // Ignore
    "0"                     // Ignore
  ]
]

GET /dapi/v1/indexPriceKlines

Kline/candlestick bars for the index price of a pair.

Klines are uniquely identified by their open time.

Weight: 1

Parameters:

Name Type Mandatory Description
pair STRING YES
interval ENUM YES
startTime LONG NO
endTime LONG NO
limit INT NO Default 500; max 1500.

Mark Price Kline/Candlestick Data

Response:

[
  [
    1591256460000,          // Open time
    "9653.29201333",        // Open
    "9654.56401333",        // High
    "9653.07367333",        // Low
    "9653.07367333",        // Close (or latest price)
    "0  ",                  // Ignore
    1591256519999,          // Close time
    "0",                    // Ignore
    60,                     // Number of bisic data
    "0",                    // Ignore
    "0",                    // Ignore
    "0"                     // Ignore
  ]
]

GET /dapi/v1/markPriceKlines

Kline/candlestick bars for the mark price of 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.

24hr Ticker Price Change Statistics

Response:

[
    {
        "symbol": "BTCUSD_200925",
        "pair": "BTCUSD",
        "priceChange": "136.6",
        "priceChangePercent": "1.436",
        "weightedAvgPrice": "9547.3",
        "lastPrice": "9651.6",
        "lastQty": "1",
        "openPrice": "9515.0",
        "highPrice": "9687.0",
        "lowPrice": "9499.5",
        "volume": "494109",
        "baseVolume": "5192.94797687",
        "openTime": 1591170300000,
        "closeTime": 1591256718418,
        "firstId": 600507, // First tradeId
        "lastId": 697803,  // Last tradeId
        "count": 97297    // Trade count    
    }
]

GET /dapi/v1/ticker/24hr

24 hour rolling window price change statistics.
Careful when accessing this with no symbol.

Weight:

Parameters:

Name Type Mandatory Description
symbol STRING NO
pair STRING NO

Symbol Price Ticker

Response:

[
    {
        "symbol": "BTCUSD_200626",  
        "ps": "9647.8",             // pair 
        "price": "9647.8",      
        "time": 1591257246176  
    }
]

GET /dapi/v1/ticker/price

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
pair STRING NO

Symbol Order Book Ticker

[
    {
        "symbol": "BTCUSD_200626",
        "pair": "BTCUSD",
        "bidPrice": "9650.1",
        "bidQty": "16",
        "askPrice": "9650.3",
        "askQty": "7",
        "time": 1591257300345
    }
]

GET /dapi/v1/ticker/bookTicker

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
pair STRING NO

Get all Liquidation Orders

Response:

[
    {
        "symbol": "BTCUSD_200925",     // SYMBOL
        "price": "9425.5",            // ORDER_PRICE
        "origQty": "1",                 // ORDER_AMOUNT
        "executedQty": "1",               // FILLED_AMOUNT
        "avragePrice": "9496.5",         // AVG_PRICE
        "status": "FILLED",            // STATUS
        "timeInForce": "IOC",          // TIME_IN_FORCE
        "type": "LIMIT",                // ORDER TYPE
        "side": "SELL",                 // DIRECTION
        "time": 1591154240949
    },
]

GET /dapi/v1/allForceOrders

Weight: 5

Parameters:

Name Type Mandatory Description
symbol STRING NO
pair STRING NO
startTime LONG NO
endTime LONG NO Default precent timestamp
limit LONG NO Max returned data number from endTime; Default:100 Max:1000

Open Interest

Response:

{
    "symbol": "BTCUSD_200626",
    "pair": "BTCUSD",
    "openInterest": "15004",
    "contractType": "CURRENT_QUARTER",
    "time": 1591261042378
}

Get present open interest of a specific symbol.

GET /dapi/v1/openInterest

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES

Websocket Market Streams

Live Subscribing/Unsubscribing to streams

Subscribe to a stream

Response

  {
    "result": null,
    "id": 1
  }

Unsubscribe to a stream

Response

  {
    "result": null,
    "id": 312
  }

{
"method": "UNSUBSCRIBE",
"params":
[
"btcusd_200925@depth"
],
"id": 312
}

Listing Subscriptions

Response

  {
    "result": [
      "btcusd_200925@aggTrade"
    ],
    "id": 3
  }

{
"method": "LIST_SUBSCRIPTIONS",
"id": 3
}

Setting Properties

Currently, the only property can be set is to set whether combined stream payloads are enabled are not. The combined property is set to false when connecting using /ws/ ("raw streams") and true when connecting using /stream/.

Response

  {
    "result": null,
    "id": 5
  }

{
"method": "SET_PROPERTY",
"params":
[
"combined",
true
],
"id": 5
}

Retrieving Properties

Response

  {
    "result": true, // Indicates that combined is set to true.
    "id": 2
  }

{
"method": "GET_PROPERTY",
"params":
[
"combined"
],
"id": 2
}

Aggregate Trade Streams

Payload:

{
  "e":"aggTrade",       // Event type
  "E":1591261134288,    // Event time
  "a":424951,               // Aggregate trade ID
  "s":"BTCUSD_200626",  // Symbol
  "p":"9643.5",         // Price
  "q":"2",              // Quantity
  "f":606073,               // First trade ID
  "l":606073,               // Last trade ID
  "T":1591261134199,    // Trade time
  "m":false             / Is the buyer the market maker?
}

The Aggregate Trade Streams push trade information that is aggregated for a single taker order every 100 milliseconds.

Stream Name:
<symbol>@aggTrade

Update Speed: 100ms

Index Price Stream

Payload:

  {
    "e": "indexPriceUpdate",  // Event type
    "E": 1591261236000,       // Event time
    "i": "BTCUSD",            // Pair
    "p": "9636.57860000",       // Index Price
  }

Stream Name:
<pair>@indexPrice OR <pair>@indexPrice@1s

Update Speed: 3000ms OR 1000ms

Mark Price Stream

Payload:

  {
    "e": "indexPriceUpdate",  // Event type
    "E": 1591261293000,      // Event time
    "s": "BTCUSD_200626",    // Symbol
    "p": "9639.94606000",    // Mark Price
    "P": "9637.20647312"     // Estimated Settle Price, only useful in the last hour before the settlement starts.
  }

Stream Name:
<symbol>@markPrice OR <symbol>@markPrice@1s

Update Speed: 3000ms OR 1000ms

Mark Price of All Symbols of a Pair

Payload:

[ 
  {
    "e": "markPriceUpdate",  // Event type
    "E": 1591261293000,      // Event time
    "s": "BTCUSD_200626",    // Symbol
    "p": "9639.94606000",    // Mark Price
    "P": "9637.20647312"     // Estimated Settle Price, only useful in the last hour before the settlement starts.
  }
]

Stream Name:
<pair>@markPrice OR <pair>@markPrice@1s

Update Speed: 3000ms OR 1000ms

Kline/Candlestick Streams

Payload:

{
  "e":"kline",              // Event type
  "E":1591261542539,        // Event time
  "s":"BTCUSD_200626",      // Symbol
  "k":{
    "t":1591261500000,      // Kline start time
    "T":1591261559999,      // Kline close time
    "s":"BTCUSD_200626",    // Symbol
    "i":"1m",               // Interval
    "f":606400,             // First trade ID
    "L":606430,             // Last trade ID
    "o":"9638.9",           // Open price
    "c":"9639.8",           // Close price
    "h":"9639.8",           // High price
    "l":"9638.6",           // Low price
    "v":"156",              // volume
    "n":31,                 // Number of trades
    "x":false,              // Is this kline closed?
    "q":"1.61836886",       // Base asset volume
    "V":"73",               // Taker buy volume
    "Q":"0.75731156",       // Taker buy base asset volume
    "B":"0"                 // Ignore
  }
}

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:
<symbol>@kline_<interval>

e.g. "btcusd_200626@kline_1m"

Update Speed: 250ms

Continues Contract Kline/Candlestick Streams

Payload:

{
  "e":"continuous_kline",   // Event type
  "E":1591261542539,        // Event time
  "ps":"BTCUSD",            // Pair
  "ct":"NEXT_QUARTER"       // Contract type
  "k":{
    "t":1591261500000,      // Kline start time
    "T":1591261559999,      // Kline close time
    "i":"1m",               // Interval
    "f":606400,             // First trade ID
    "L":606430,             // Last trade ID
    "o":"9638.9",           // Open price
    "c":"9639.8",           // Close price
    "h":"9639.8",           // High price
    "l":"9638.6",           // Low price
    "v":"156",              // volume
    "n":31,                 // Number of trades
    "x":false,              // Is this kline closed?
    "q":"1.61836886",       // Base asset volume
    "V":"73",               // Taker buy volume
    "Q":"0.75731156",       // Taker buy base asset volume
    "B":"0"                 // Ignore
  }
}

Contract type:

Kline/Candlestick chart intervals:

m -> minutes; h -> hours; d -> days; w -> weeks; M -> months

Stream Name:
<pair>_<contractType>@continuousKline_<interval>

e.g. "btcusd_next_quarter@continuousKline_1m"

Update Speed: 250ms

Index Kline/Candlestick Streams

Payload:


{
  "e":"indexPrice_kline",       // Event Name
  "E":1591267070033,            // Event Time
  "ps":"BTCUSD",                // Pair
  "k":{
    "t":1591267020000,          // Kline start time
    "T":1591267079999,          // Kline close time
    "s":"0",                    // ignore
    "i":"1m",                   // Interval
    "f":1591267020000,          // ignore
    "L":1591267070000,          // ignore
    "o":"9542.21900000",        // Open price
    "c":"9542.50440000",        // Close price
    "h":"9542.71640000",        // High price
    "l":"9542.21040000",        // Low price
    "v":"0",                    // ignore
    "n":51,                     // Number of basic data
    "x":false,                  // Is this kline closed?
    "q":"0",                    // ignore
    "V":"0",                    // ignore
    "Q":"0",                    // ignore
    "B":"0"                     // ignore
  }
}

Kline/Candlestick chart intervals:

m -> minutes; h -> hours; d -> days; w -> weeks; M -> months

Stream Name:
<pair>@indexPriceKline_<interval>

e.g. "btcusd@indexPriceKline_1m"

Update Speed: 250ms

Mark Price Kline/Candlestick Streams

Payload:

{
  "e":"markPrice_kline",        // Event Name
  "E":1591267398004,            // Event Time
  "ps":"BTCUSD",                // Pair
  "k":{
    "t":1591267380000,          // Kline start time
    "T":1591267439999,          // Kline close time
    "s":"BTCUSD_200626",        // Symbol
    "i":"1m",                   // Interval
    "f":1591267380000,          // ignore
    "L":1591267398000,          // ignore
    "o":"9539.67161333",        // Open price
    "c":"9540.82761333",        // Close price
    "h":"9540.82761333",        // High price
    "l":"9539.66961333",        // Low price
    "v":"0",                    // ignore
    "n":19,                     // Number of basic data
    "x":false,                  // Is this kline closed?
    "q":"0",                    // ignore
    "V":"0",                    // ignore
    "Q":"0",                    // ignore
    "B":"0"                     // ignore
  }
}

Kline/Candlestick chart intervals:

m -> minutes; h -> hours; d -> days; w -> weeks; M -> months

Stream Name:
<symbol>@markPriceKline_<interval>

e.g. "btcusd_200626@markPriceKline_1m"

Update Speed: 250ms

Individual Symbol Mini Ticker Stream

Payload:

{
  "e":"24hrMiniTicker",         // Event type
  "E":1591267704450,            // Event time
  "s":"BTCUSD_200626",          // Symbol
  "ps":"BTCUSD",                // Pair
  "c":"9561.7",                 // Close price
  "o":"9580.9",                 // Open price
  "h":"10000.0",                // High price
  "l":"7000.0",                 // Low price
  "v":"487476",                 // Total traded volume
  "q":"33264343847.22378500"    // Total traded base asset volume
}

24hr rolling window mini-ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before.

Stream Name:
<symbol>@miniTicker

Update Speed: 500ms

All Market Mini Tickers Stream

Payload:

[  
    {
      "e":"24hrMiniTicker",         // Event type
      "E":1591267704450,            // Event time
      "s":"BTCUSD_200626",          // Symbol
      "ps":"BTCUSD",                // Pair
      "c":"9561.7",                 // Close price
      "o":"9580.9",                 // Open price
      "h":"10000.0",                // High price
      "l":"7000.0",                 // Low price
      "v":"487476",                 // Total traded volume
      "q":"33264343847.22378500"    // Total traded base asset volume
    }
]

24hr rolling window mini-ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array.

Stream Name:
!miniTicker@arr

Update Speed: 1000ms

Individual Symbol Ticker Streams

Payload:

{
  "e":"24hrTicker",             // Event type
  "E":1591268262453,            // Event time
  "s":"BTCUSD_200626",          // Symbol
  "ps":"BTCUSD",                // Pair
  "p":"-43.4",                  // Price change
  "P":"-0.452",                 // Price change percent
  "w":"0.00147974",             // Weighted average price
  "c":"9548.5",                 // Last price
  "Q":"2",                      // Last quantity
  "o":"9591.9",                 // Open price
  "h":"10000.0",                // High price
  "l":"7000.0",                 // Low price
  "v":"487850",                 // Total traded volume
  "q":"32968676323.46222700",   // Total traded base asset volume
  "O":1591181820000,            // Statistics open time
  "C":1591268262442,            // Statistics close time
  "F":512014,                   // First trade ID
  "L":615289,                   // Last trade Id
  "n":103272                    // Total number of trades
}

24hr rollwing window ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before.

Stream Name:
<symbol>@ticker

Update Speed: 500ms

All Market Tickers Streams

Payload:

[
    {
      "e":"24hrTicker",             // Event type
      "E":1591268262453,            // Event time
      "s":"BTCUSD_200626",          // Symbol
      "ps":"BTCUSD",                // Pair
      "p":"-43.4",                  // Price change
      "P":"-0.452",                 // Price change percent
      "w":"0.00147974",             // Weighted average price
      "c":"9548.5",                 // Last price
      "Q":"2",                      // Last quantity
      "o":"9591.9",                 // Open price
      "h":"10000.0",                // High price
      "l":"7000.0",                 // Low price
      "v":"487850",                 // Total traded volume
      "q":"32968676323.46222700",   // Total traded base asset volume
      "O":1591181820000,            // Statistics open time
      "C":1591268262442,            // Statistics close time
      "F":512014,                   // First trade ID
      "L":615289,                   // Last trade Id
      "n":103272                    // Total number of trades
    }
]

24hr rollwing window ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array.

Stream Name:
!ticker@arr

Update Speed: 1000ms

Individual Symbol Book Ticker Streams

Payload:

{
  "e":"bookTicker",         // event name
  "u":17242169,             // order book updateId
  "s":"BTCUSD_200626",      // symbol
  "ps":"BTCUSD",                // Pair
  "b":"9548.1",             // best bid price
  "B":"52",                 // best bid qty
  "a":"9548.5",             // best ask price
  "A":"11",                 // best ask qty
  "T":1591268628155,        // transaction time
  "E":1591268628166         // event time
}

Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol.

Stream Name: <symbol>@bookTicker

Update Speed: Real-time

All Book Tickers Stream

Payload:

{
  // Same as <symbol>@bookTicker payload
}

Pushes any update to the best bid or ask's price or quantity in real-time for all symbols.

Stream Name: !bookTicker

Update Speed: Real-time

Liquidation Order Streams

Payload:

{

    "e":"forceOrder",                    // Event Type
    "E": 1591154240950,                 // Event Time
    "o":{

        "s":"BTCUSD_200925",           // Symbol
        "ps": "BTCUSD",                 // Pair
        "S":"SELL",                     // Side
        "o":"LIMIT",                    // Order Type
        "f":"IOC",                      // Time in Force
        "q":"1",                        // Original Quantity
        "p":"9425.5",                   // Price
        "ap":"9496.5",                  // Average Price
        "X":"FILLED",                   // Order Status
        "l":"1",                        // Order Last Filled Quantity
        "z":"1",                        // Order Filled Accumulated Quantity
        "T": 1591154240949,             // Order Trade Time

    }
}

The Liquidation Order Streams push force liquidation order information for specific symbol

Stream Name:  <symbol>@forceOrder

Update Speed: Real-time

All Market Liquidation Order Streams

Payload:

{

    "e":"forceOrder",                    // Event Type
    "E": 1591154240950,                 // Event Time
    "o":{

        "s":"BTCUSD_200925",           // Symbol
        "ps": "BTCUSD",                 // Pair
        "S":"SELL",                     // Side
        "o":"LIMIT",                    // Order Type
        "f":"IOC",                      // Time in Force
        "q":"1",                        // Original Quantity
        "p":"9425.5",                   // Price
        "ap":"9496.5",                  // Average Price
        "X":"FILLED",                   // Order Status
        "l":"1",                        // Order Last Filled Quantity
        "z":"1",                        // Order Filled Accumulated Quantity
        "T": 1591154240949,             // Order Trade Time

    }
}

The All Liquidation Order Streams push force liquidation order information for all symbols in the market.

Stream Name: !forceOrder@arr

Update Speed: Real-time

Partial Book Depth Streams

Payload:

{
  "e":"depthUpdate",        // Event type
  "E":1591269996801,        // Event time
  "T":1591269996646,        // Transaction time
  "s":"BTCUSD_200626",      // Symbol
  "ps":"BTCUSD",            // Pair
  "U":17276694,
  "u":17276701,
  "pu":17276678,
  "b":[                     // Bids to be updated
    [
      "9523.0",             // Price Level
      "5"                   // Quantity
    ],
    [
      "9522.8",
      "8"
    ],
    [
      "9522.6",
      "2"
    ],
    [
      "9522.4",
      "1"
    ],
    [
      "9522.0",
      "5"
    ]
  ],
  "a":[                     // Asks to be updated
    [
      "9524.6",             // Price level to be
      "2"                   // Quantity
    ],
    [
      "9524.7",
      "3"
    ],
    [
      "9524.9",
      "16"
    ],
    [
      "9525.1",
      "10"
    ],
    [
      "9525.3",
      "6"
    ]
  ]
}

Top bids and asks, Valid are 5, 10, or 20.

Stream Names: <symbol>@depth<levels> OR <symbol>@depth<levels>@500ms OR <symbol>@depth<levels>@100ms.

Update Speed: 250ms, 500ms or 100ms

Diff. Book Depth Streams

Payload:

{
  "e": "depthUpdate",           // Event type
  "E": 1591270260907,           // Event time
  "T": 1591270260891,           // Transction time
  "s": "BTCUSD_200626",         // Symbol
  "ps": "BTCUSD",               // Pair
  "U": 17285681,                // first update Id from last stream
  "u": 17285702,                // last update Id from last stream
  "pu": 17285675,               // last update Id in last stream(ie ‘u’ in last stream)
  "b": [                        // Bids to be updated
    [
      "9517.6",                 // Price level to be updated
      "10"                      // Quantity
    ]
  ],
  "a": [                        // Asks to be updated
    [
      "9518.5",                 // Price level to be updated
      "45"                      // Quantity
    ]
  ]
}

Bids and asks, pushed every 250 milliseconds, 500 milliseconds, or 100 milliseconds

Stream Name:
<symbol>@depth OR <symbol>@depth@500ms OR <symbol>@depth@100ms

Update Speed: 250ms, 500ms, 100ms

How to manage a local order book correctly

  1. Open a stream to wss://dstream.binancefuture.com/stream?streams=btcusd_200925@depth.
  2. Buffer the events you receive from the stream. For same price, latest received update covers the previous one.
  3. Get a depth snapshot from https://testnet.binancefuture.com/dapi/v1/depth?symbol=BTCUSD_200925&limit=1000 .
  4. Drop any event where u is < lastUpdateId in the snapshot
  5. The first processed event should have U <= lastUpdateId AND u >= lastUpdateId
  6. 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.
  7. The data in each event is the absolute quantity for a price level
  8. If the quantity is 0, remove the price level
  9. Receiving an event that removes a price level that is not in your local order book can happen and is normal.

Account/Trades Endpoints

Change Position Mode(TRADE)

Response:

{
    "code": 200,
    "msg": "success"
}

POST /dapi/v1/positionSide/dual (HMAC SHA256)

Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol

Weight: 1

Parameters:

Name Type Mandatory Description
dualSidePosition STRING YES "true": Hedge Mode mode; "false": One-way Mode
recvWindow LONG NO
timestamp LONG YES

Get Current Position Mode(USER_DATA)

Response:

{
    "dualSidePosition": true // "true": Hedge Mode mode; "false": One-way Mode
}

GET /dapi/v1/positionSide/dual (HMAC SHA256)

Get user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol

Weight: 30

Parameters:

Name Type Mandatory Description
recvWindow LONG NO
timestamp LONG YES

New Order (TRADE)

Response:

{
    "clientOrderId": "testOrder",
    "cumQty": "0",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 22542179,
    "avgPrice": "0.0",
    "origQty": "10",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT", 
    "status": "NEW",
    "stopPrice": "9300",                // please ignore when order type is TRAILING_STOP_MARKET
    "closePosition": false,            // if Close-All
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "timeInForce": "GTC",
    "type": "TRAILING_STOP_MARKET",
    "origType": "TRAILING_STOP_MARKET",  
    "activatePrice": "9020",            // activation price, only return with TRAILING_STOP_MARKET order
    "priceRate": "0.3",                 // callback rate, only return with TRAILING_STOP_MARKET order
    "updateTime": 1566818724722,
    "workingType": "CONTRACT_PRICE",
    "priceProtect": false            // if conditional order trigger is protected
}

POST /dapi/v1/order (HMAC SHA256)

Send in a new order.

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
side ENUM YES
positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent in Hedge Mode.
type ENUM YES
timeInForce ENUM NO
quantity DECIMAL NO Cannot be sent with closePosition=true
reduceOnly STRING NO "true" or "false". Defalt "false". Cannot be sent in Hedge Mode; cannot be sent with closePosition=true(Close-All)
price DECIMAL NO
newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent.
stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders.
closePosition STRING NO true, false;Close-All,used with STOP_MARKET or TAKE_PROFIT_MARKET.
activationPrice DECIMAL NO Used with TRAILING_STOP_MARKET orders, default as the latest price(supporting different workingType)
callbackRate DECIMAL NO Used with TRAILING_STOP_MARKET orders, min 0.1, max 5 where 1 for 1%
workingType ENUM NO stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE"
newOrderRespType ENUM NO "ACK", "RESULT", default "ACK"
recvWindow LONG NO
timestamp LONG YES

Additional mandatory parameters based on type:

Type Additional mandatory parameters
LIMIT timeInForce, quantity, price
MARKET quantity
STOP/TAKE_PROFIT price, stopPrice
STOP_MARKET/TAKE_PROFIT_MARKET stopPrice
TRAILING_STOP_MARKET callbackRate

Place Multiple Orders (TRADE)

Response:

[
    {
        "clientOrderId": "testOrder",
        "cumQty": "0",
        "cumBase": "0",
        "executedQty": "0",
        "orderId": 22542179,
        "avgPrice": "0.0",
        "origQty": "10",
        "price": "0",
        "reduceOnly": false,
        "side": "BUY",
        "positionSide": "SHORT",
        "status": "NEW",
        "stopPrice": "9300",        // please ignore when order type is TRAILING_STOP_MARKET
        "symbol": "BTCUSD_200925",
        "pair": "BTCUSD",
        "timeInForce": "GTC",
        "type": "TRAILING_STOP_MARKET",
        "origType": "TRAILING_STOP_MARKET", 
        "activatePrice": "9020",    // activation price, only return with TRAILING_STOP_MARKET order
        "priceRate": "0.3",         // callback rate, only return with TRAILING_STOP_MARKET order
        "updateTime": 1566818724722,
        "workingType": "CONTRACT_PRICE",
        "priceProtect": false            // if conditional order trigger is protected
    },
    {
        "code": -2022, 
        "msg": "ReduceOnly Order is rejected."
    }
]

POST /dapi/v1/batchOrders (HMAC SHA256)

Weight: 5

Parameters:

Name Type Mandatory Description
batchOrders LIST YES order list. Max 5 orders
recvWindow LONG NO
timestamp LONG YES

Where batchOrders is the list of order parameters in JSON

Name Type Mandatory Description
symbol STRING YES
side ENUM YES
positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent with Hedge Mode.
type ENUM YES
timeInForce ENUM NO
quantity DECIMAL YES
reduceOnly STRING NO "true" or "false". Defalt "false".
price DECIMAL NO
newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent.
stopPrice DECIMAL NO Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders.
activationPrice DECIMAL NO Used with TRAILING_STOP_MARKET orders, default as the latest price(supporting different workingType)
callbackRate DECIMAL NO Used with TRAILING_STOP_MARKET orders, min 0.1, max 4 where 1 for 1%
workingType ENUM NO stopPrice triggered by: "MARK_PRICE", "CONTRACT_PRICE". Default "CONTRACT_PRICE"
priceProtect STRING NO "true" or "false", default "false". Used with STOP/STOP_MARKET or TAKE_PROFIT/TAKE_PROFIT_MARKET orders.
newOrderRespType ENUM NO "ACK", "RESULT", default "ACK"

Query Order (USER_DATA)

Response:

{
    "avgPrice": "0.0",
    "clientOrderId": "abc",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 1917641,
    "origQty": "0.40",
    "origType": "TRAILING_STOP_MARKET",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "status": "NEW",
    "stopPrice": "9300",                // please ignore when order type is TRAILING_STOP_MARKET
    "closePosition": false,             // if Close-All
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "time": 1579276756075,              // order time
    "timeInForce": "GTC",
    "type": "TRAILING_STOP_MARKET",
    "activatePrice": "9020",            // activation price, only return with TRAILING_STOP_MARKET order
    "priceRate": "0.3",                 // callback rate, only return with TRAILING_STOP_MARKET order
    "updateTime": 1579276756075,        // update time
    "workingType": "CONTRACT_PRICE",
    "priceProtect": false            // if conditional order trigger is protected
}

GET /dapi/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

Notes:

Cancel Order (TRADE)

Response:

{
    "avgPrice": "0.0",
    "clientOrderId": "myOrder1",
    "cumQty": "0",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 283194212,
    "origQty": "11",
    "origType": "TRAILING_STOP_MARKET",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",            
    "status": "CANCELED",
    "stopPrice": "9300",                // please ignore when order type is TRAILING_STOP_MARKET
    "closePosition": false,             // if Close-All
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "timeInForce": "GTC",
    "type": "TRAILING_STOP_MARKET",
    "activatePrice": "9020",            // activation price, only return with TRAILING_STOP_MARKET order
    "priceRate": "0.3",                 // callback rate, only return with TRAILING_STOP_MARKET order
    "updateTime": 1571110484038,
    "workingType": "CONTRACT_PRICE",
    "priceProtect": false            // if conditional order trigger is protected
}

DELETE /dapi/v1/order (HMAC SHA256)

Cancel an active order.

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 All Open Orders (TRADE)

Response:

{
    "code": "200", 
    "msg": "The operation of cancel all open order is done."
}

DELETE /dapi/v1/allOpenOrders (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING NO
recvWindow LONG NO
timestamp LONG YES

Cancel Multiple Orders (TRADE)

Response:

[
    {
        "avgPrice": "0.0",
        "clientOrderId": "myOrder1",
        "cumQty": "0",
        "cumBase": "0",
        "executedQty": "0",
        "orderId": 283194212,
        "origQty": "11",
        "origType": "TRAILING_STOP_MARKET",
        "price": "0",
        "reduceOnly": false,
        "side": "BUY",
        "positionSide": "SHORT",
        "status": "CANCELED",
        "stopPrice": "9300",                // please ignore when order type is TRAILING_STOP_MARKET
        "closePosition": false,             // if Close-All
        "symbol": "BTCUSD_200925",
        "timeInForce": "GTC",
        "type": "TRAILING_STOP_MARKET",
        "activatePrice": "9020",            // activation price, only return with TRAILING_STOP_MARKET order
        "priceRate": "0.3",                 // callback rate, only return with TRAILING_STOP_MARKET order
        "workingType": "CONTRACT_PRICE",
        "priceProtect": false,            // if conditional order trigger is protected
        "updateTime": 1571110484038
    },
    {
        "code": -2011,
        "msg": "Unknown order sent."
    }
]

DELETE /dapi/v1/batchOrders (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
orderIdList LIST<LONG> NO max length 10
e.g. [1234567,2345678]
origClientOrderIdList LIST<STRING> NO max length 10
e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma.
recvWindow LONG NO
timestamp LONG YES

Either orderIdList or origClientOrderIdList must be sent.

Auto-Cancel All Open Orders (TRADE)

Response:

{
    "symbol": "BTCUSD_200925", 
    "countdownTime": "100000"
}

Cancel all open orders of the specified symbol at the end of the specified countdown.

POST /dapi/v1/countdownCancelAll (HMAC SHA256)

Weight: 10

Parameters:

Name Type Mandatory Description
symbol STRING YES
countdownTime LONG YES countdown time, 1000 for 1 second. 0 to cancel the timer
recvWindow LONG NO
timestamp LONG YES

Query Current Open Order (USER_DATA)

Response:


{
    "avgPrice": "0.0",              
    "clientOrderId": "abc",             
    "cumBase": "0",                     
    "executedQty": "0",                 
    "orderId": 1917641,                 
    "origQty": "0.40",                      
    "origType": "TRAILING_STOP_MARKET",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "stopPrice": "9300",                // please ignore when order type is TRAILING_STOP_MARKET
    "closePosition": false,             // if Close-All
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD"
    "time": 1579276756075,              // order time
    "timeInForce": "GTC",
    "type": "TRAILING_STOP_MARKET",
    "activatePrice": "9020",            // activation price, only return with TRAILING_STOP_MARKET order
    "priceRate": "0.3",                 // callback rate, only return with TRAILING_STOP_MARKET order                       
    "updateTime": 1579276756075,        
    "workingType": "CONTRACT_PRICE",
    "priceProtect": false            // if conditional order trigger is protected       
}

GET /dapi/v1/openOrder (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
orderId LONG NO
origClientOrderId STRING NO
recvWindow LONG NO
timestamp LONG YES

Current All Open Orders (USER_DATA)

Response:

[
  {
    "avgPrice": "0.0",
    "clientOrderId": "abc",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 1917641,
    "origQty": "0.40",
    "origType": "TRAILING_STOP_MARKET",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "stopPrice": "9300",                // please ignore when order type is TRAILING_STOP_MARKET
    "closePosition": false,             // if Close-All
    "symbol": "BTCUSD_200925",
    "time": 1579276756075,              // order time
    "timeInForce": "GTC",
    "type": "TRAILING_STOP_MARKET",
    "activatePrice": "9020",            // activation price, only return with TRAILING_STOP_MARKET order
    "priceRate": "0.3",                 // callback rate, only return with TRAILING_STOP_MARKET order
    "updateTime": 1579276756075,        // update time
    "workingType": "CONTRACT_PRICE",
    "priceProtect": false,            // if conditional order trigger is protected
  }
]

GET /dapi/v1/openOrders (HMAC SHA256)

Get all open orders on a symbol. Careful when accessing this with no symbol.

Weight:

1 for a single symbol;
5 for multiple symbols

Parameters:

Name Type Mandatory Description
symbol STRING NO
pair STRING NO
recvWindow LONG NO
timestamp LONG YES

All Orders (USER_DATA)

Response:

[
  {
    "avgPrice": "0.0",
    "clientOrderId": "abc",
    "cumBase": "0",
    "executedQty": "0",
    "orderId": 1917641,
    "origQty": "0.40",
    "origType": "TRAILING_STOP_MARKET",
    "price": "0",
    "reduceOnly": false,
    "side": "BUY",
    "positionSide": "SHORT",
    "status": "NEW",
    "stopPrice": "9300",                // please ignore when order type is TRAILING_STOP_MARKET
    "closePosition": false,             // if Close-All
    "symbol": "BTCUSD_200925",
    "pair": "BTCUSD",
    "time": 1579276756075,              // order time
    "timeInForce": "GTC",
    "type": "TRAILING_STOP_MARKET",
    "activatePrice": "9020",            // activation price, only return with TRAILING_STOP_MARKET order
    "priceRate": "0.3",                 // callback rate, only return with TRAILING_STOP_MARKET order
    "updateTime": 1579276756075,        // update time
    "workingType": "CONTRACT_PRICE",
    "priceProtect": false            // if conditional order trigger is protected
  }
]

GET /dapi/v1/allOrders (HMAC SHA256)

Get all account orders; active, canceled, or filled.

Weight:

20 with symbol 40 with pair

Parameters:

Name Type Mandatory Description
symbol STRING NO
pair STRING NO
orderId LONG NO
startTime LONG NO
endTime LONG NO
limit INT NO Default 50; max 100.
recvWindow LONG NO
timestamp LONG YES

Notes:

Futures Account Balance (USER_DATA)

Response:

[
    {
        "accountAlias": "SgsR",    // unique account code
        "asset": "BTC",
        "balance": "0.00250000",
        "withdrawAvailable": "0.00250000",
        "updateTime": 1592468353979
    }
]

GET /dapi/v1/balance (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
recvWindow LONG NO
timestamp LONG YES

Account Information (USER_DATA)

Response:


{
    "assets": [
        {
            "asset": "BTC",
            "initialMargin": "0.33683000",   // total intial margin required with the latest mark price
            "maintMargin": "0.02695000",    // maintenance margin
            "marginBalance": "8.74947592",  // margin balance
            "maxWithdrawAmount": "8.41264592",  // available amount for transfer out
            "openOrderInitialMargin": "0.00000000", // open orders' intial margin required with the latest mark price
            "positionInitialMargin": "0.33683000", // positions' margin required with the latest mark price
            "unrealizedProfit": "-0.44537584",  // unrealized profit or loss
            "walletBalance": "9.19485176"
        }
     ],
     "positions": [
         {
            "isolated": false, 
            "leverage": "20", 
            "initialMargin": "0.33", 
            "maintMargin": "0.02", 
            "openOrderInitialMargin": "0.00", 
            "positionInitialMargin": "0.33",
            "symbol": "BTCUSD_200925",
            "unrealizedProfit": "-0.44537584", 
            "positionSide": "BOTH", // BOTH means that it is the position of One-way Mode  
         },
         {
            "isolated": false, 
            "leverage": "20", 
            "initialMargin": "0.00", 
            "maintMargin": "0.00", 
            "openOrderInitialMargin": "0.00", 
            "positionInitialMargin": "0.00", 
            "symbol": "BTCUSD_200925", 
            "unrealizedProfit": "0.00000000", 
            "positionSide": "LONG", // LONG or SHORT means that it is the position of Hedge Mode 
         },
         {
            "isolated": false,
            "leverage": "20", 
            "initialMargin": "0.00", 
            "maintMargin": "0.00", 
            "openOrderInitialMargin": "0.00", 
            "positionInitialMargin": "0.00", 
            "symbol": "BTCUSD_200925",
            "unrealizedProfit": "0.00000000", 
            "positionSide": "SHORT", // LONG or SHORT means that it is the position of One-way Mode  
         }
     ],
     "canDeposit": true,
     "canTrade": true,
     "canWithdraw": true,
     "feeTier": 2,
     "updateTime": 0
 }

GET /dapi/v1/account (HMAC SHA256)

Get current account information.

Weight: 5

Parameters:

Name Type Mandatory Description
recvWindow LONG NO
timestamp LONG YES

Change Initial Leverage (TRADE)

Response:

{
    "leverage": 21,
    "maxQty": "1000",  // maximum quantity of base asset
    "symbol": "BTCUSD_200925"
}

POST /dapi/v1/leverage (HMAC SHA256)

Change user's initial leverage in the specific symbol market.
For Hedge Mode, LONG and SHORT positions of one symbol use the same initial leverage and share a total notional value.

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
leverage INT YES target initial leverage: int from 1 to 125
recvWindow LONG NO
timestamp LONG YES

Change Margin Type (TRADE)

Response:

{
    "code": 200,
    "msg": "success"
}

Change user's margin type in the specific symbol market.For Hedge Mode, LONG and SHORT positions of one symbol use the same margin type.
With ISOLATED margin type, margins of the LONG and SHORT positions are isolated from each other.

POST /dapi/v1/marginType (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
marginType ENUM YES ISOLATED, CROSSED
recvWindow LONG NO
timestamp LONG YES

Modify Isolated Position Margin (TRADE)

Response:

{
    "amount": 100.0,
    "code": 200,
    "msg": "Successfully modify position margin.",
    "type": 1
}

POST /dapi/v1/positionMargin (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
positionSide ENUM NO Default BOTH for One-way Mode ; LONG or SHORT for Hedge Mode. It must be sent with Hedge Mode.
amount DECIMAL YES
type INT YES 1: Add position margin,2: Reduce position margin
recvWindow LONG NO
timestamp LONG YES

Get Position Margin Change History (TRADE)

Response:

[
    {
        "amount": "23.36332311",
        "asset": "BTC",
        "symbol": "BTCUSD_200925",
        "time": 1578047897183,
        "type": 1,
        "positionSide": "BOTH"
    },
    {
        "amount": "100",
        "asset": "BTC",
        "symbol": "BTCUSD_200925",
        "time": 1578047900425,
        "type": 1,
        "positionSide": "LONG"
    }
]

GET /dapi/v1/positionMargin/history (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
type INT NO 1: Add position margin,2: Reduce position margin
startTime LONG NO
endTime LONG NO
limit INT NO 默认值: 50
recvWindow LONG NO
timestamp LONG YES

Position Information (USER_DATA)

Response:

[
    {
        "entryPrice": "0.00000",
        "marginType": "isolated", 
        "isAutoAddMargin": "false",
        "isolatedMargin": "0.00000000", 
        "leverage": "10", 
        "liquidationPrice": "0", 
        "markPrice": "6679.50671178",   
        "maxQty": "20000000", // maximum quantity of base asset
        "positionAmt": "0", 
        "symbol": "BTCUSD_200925", 
        "unRealizedProfit": "0.00000000", 
        "positionSide": "BOTH",
    },
    {
        "entryPrice": "6563.66500", 
        "marginType": "isolated", 
        "isAutoAddMargin": "false",
        "isolatedMargin": "15517.54150468",
        "leverage": "10",
        "liquidationPrice": "5930.78",
        "markPrice": "6679.50671178",   
        "maxQty": "20000000", 
        "positionAmt": "20", 
        "symbol": "BTCUSD_200925", 
        "unRealizedProfit": "2316.83423560"
        "positionSide": "LONG", 
    },
    {
        "entryPrice": "0.00000",
        "marginType": "isolated", 
        "isAutoAddMargin": "false",
        "isolatedMargin": "5413.95799991", 
        "leverage": "10", 
        "liquidationPrice": "7189.95", 
        "markPrice": "6679.50671178",   
        "maxQty": "20000000", 
        "positionAmt": "-10", 
        "symbol": "BTCUSD_200925",
        "unRealizedProfit": "-1156.46711780" 
        "positionSide": "SHORT",
    }
]

GET /dapi/v1/positionRisk (HMAC SHA256) Get current account information.

Weight: 5

Parameters:

Name Type Mandatory Description
marginAsset STRING NO
pair STRING NO
recvWindow LONG NO
timestamp LONG YES

Note
Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs.

Account Trade List (USER_DATA)

Response:

[
    {
        'symbol': 'BTCUSD_200626',
        'id': 6,
        'orderId': 28,
        'pair': 'BTCUSD',
        'side': 'SELL',
        'price': '8800',
        'qty': '1',
        'realizedPnl': '0',
        'marginAsset': 'BTC',
        'baseQty': '0.01136364',
        'commission': '0.00000454',
        'commissionAsset': 'BTC',
        'time': 1590743483586,
        'positionSide': 'BOTH',
        'buyer': false,
        'maker': false
    }
]

GET /dapi/v1/userTrades (HMAC SHA256)

Get trades for a specific account and symbol.

Weight:

20 with symbol 40 with pair

Parameters:

Name Type Mandatory Description
symbol STRING NO
pair STRING NO
startTime LONG NO
endTime LONG NO
fromId LONG NO Trade id to fetch from. Default gets most recent trades.
limit INT NO Default 50; max 100.
recvWindow LONG NO
timestamp LONG YES

Get Income History(USER_DATA)

Response:

[
    {
        "symbol": "",
        "incomeType": "TRANSFER",
        "income": "-0.37500000",
        "asset": "BTC",
        "info":"",                  
        "time": 1570608000000,
    },
    {
        "symbol": "BTCUSD_200925",
        "incomeType": "COMMISSION", 
        "income": "-0.01000000",
        "asset": "BTC",
        "info":"",
        "time": 1570636800000,
    }
]

GET /dapi/v1/income (HMAC SHA256)

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING NO
incomeType STRING NO "TRANSFER","WELCOME_BONUS", "REALIZED_PNL","FUNDING_FEE", "COMMISSION", and "INSURANCE_CLEAR"
startTime LONG NO Timestamp in ms to get funding from INCLUSIVE.
endTime LONG NO Timestamp in ms to get funding until INCLUSIVE.
limit INT NO Default 100; max 1000
recvWindow LONG NO
timestamp LONG YES

Notional Bracket (USER_DATA)

Response:

[
    {
        "pair": "BTCUSD",
        "brackets": [
            {
                "bracket": 1,   // bracket level
                "initialLeverage": 125,  // the maximum leverage
                "qtyCap": 50,  // upper edge of base asset quantity
                "qtylFloor": 0,  // lower edge of base asset quantity
                "maintMarginRatio": 0.004 // maintenance margin rate
            },
        ]
    }
[

GET /dapi/v1/leverageBracket

Weight: 1

Parameters:

Name Type Mandatory Description
pair STRING NO
recvWindow LONG NO
timestamp LONG YES

User Data Streams

Start User Data Stream (USER_STREAM)

Response:

{
  "listenKey": "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1"
}

POST /dapi/v1/listenKey

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

Parameters:

None

Keepalive User Data Stream (USER_STREAM)

Response:

{}

PUT /dapi/v1/listenKey

Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes.

Weight: 1

Parameters:

None

Close User Data Stream (USER_STREAM)

Response:

{}

DELETE /dapi/v1/listenKey

Close out a user data stream.

Weight: 1

Parameters:

None

Event: Margin Call

Payload:

{
    "e":"MARGIN_CALL",      // Event Type
    "E":1587727187525,      // Event Time
    "i": "SfsR",                // Account Alias
    "cw":"3.16812045",      // Cross Wallet Balance. Only pushed with crossed position margin call
    "p":[                   // Position(s) of Margin Call
      {
        "s":"BTCUSD_200925",        // Symbol
        "ps":"LONG",        // Position Side
        "pa":"132",         // Position Amount
        "mt":"CROSSED",     // Margin Type
        "iw":"0",           // Isolated Wallet (if isolated position)
        "mp":"9187.17127000",   // Mark Price
        "up":"-1.166074",   // Unrealized PnL
        "mm":"1.614445"     // Maintenance Margin Required
      }
    ]
}  

Event: Balance and Position Update

Payload:

{
  "e": "ACCOUNT_UPDATE",                // Event Type
  "E": 1564745798939,                   // Event Time
  "T": 1564745798938 ,                  // Transaction
  "i": "SfsR",                          // Account Alias
  "a":                                  // Update Data
    {
      "B":[                             // Balances
        {
          "a":"BTC",                // Asset
          "wb":"122624.12345678",       // Wallet Balance
          "cw":"100.12345678"           // Cross Wallet Balance
        },
        {
          "a":"ETH",           
          "wb":"1.00000000",
          "cw":"0.00000000"         
        }
      ],
      "P":[
        {
          "s":"BTCUSD_200925",       // Symbol
          "pa":"0",                 // Position Amount
          "ep":"0.0",            // Entry Price
          "cr":"200",               // (Pre-fee) Accumulated Realized
          "up":"0",                     // Unrealized PnL
          "mt":"isolated",              // Margin Type
          "iw":"0.00000000",            // Isolated Wallet (if isolated position)
          "ps":"BOTH"                   // Position Side
        },
        {
            "s":"BTCUSD_200925",
            "pa":"20",
            "ep":"6563.6",
            "cr":"0",
            "up":"2850.21200000",
            "mt":"isolated",
            "iw":"13200.70726908",
            "ps":"LONG"
         },
        {
            "s":"BTCUSD_200925",
            "pa":"-10",
            "ep":"6563.8",
            "cr":"-45.04000000",
            "up":"-1423.15600000",
            "mt":"isolated",
            "iw":"6570.42511771",
            "ps":"SHORT"
        }
      ]
    }
}

Event type is ACCOUNT_UPDATE.

Event: Order Update

Payload:

{

  "e":"ORDER_TRADE_UPDATE",     // Event Type
  "E":1591274595442,            // Event Time
  "T":1591274595453,            // Trasaction Time
  "i":"SfsR",                           // Account Alias
  "o":{                             
    "s":"BTCUSD_200925",                // Symbol
    "c":"TEST",                 // Client Order Id
      // special client order id:
      // starts with "autoclose-": liquidation order
      // "adl_autoclose": ADL auto close order
    "S":"SELL",                 // Side
    "o":"TRAILING_STOP_MARKET", // Order Type
    "f":"GTC",                  // Time in Force
    "q":"2",                // Original Quantity
    "p":"0",                    // Original Price
    "ap":"0",                   // Average Price
    "sp":"9103.1",              // Stop Price. Please ignore with TRAILING_STOP_MARKET order
    "x":"NEW",                  // Execution Type
    "X":"NEW",                  // Order Status
    "i":8888888,                // Order Id
    "l":"0",                    // Order Last Filled Quantity
    "z":"0",                    // Order Filled Accumulated Quantity
    "L":"0",                    // Last Filled Price
    "ma": "BTC",                // Margin Asset
    "N":"BTC",                  // Commission Asset of the trade, will not push if no commission
    "n":"0",                // Commission of the trade, will not push if no commission
    "T":1591274595442,          // Order Trade Time
    "t":0,                      // Trade Id
    "rp": "0",                  // Realized Profit of the trade
    "b":"0",                    // Bid quantity of base asset
    "a":"0",                    // Ask quantity of base asset
    "m":false,                  // Is this trade the maker side?
    "R":false,                  // Is this reduce only
    "wt":"CONTRACT_PRICE",      // Stop Price Working Type
    "ot":"TRAILING_STOP_MARKET",    // Original Order Type
    "ps":"LONG",                        // Position Side
    "cp":false,                     // If Close-All, pushed with conditional order
    "AP":"9476.8",              // Activation Price, only puhed with TRAILING_STOP_MARKET order
    "cr":"5.0",                 // Callback Rate, only puhed with TRAILING_STOP_MARKET order
    "pP": false                 // If conditional order trigger is protected
  }

}

When new order created, order status changed will push such event. event type is ORDER_TRADE_UPDATE.

Side

Position side:

Order Type

Execution Type

Order Status

Time in force

Error Codes

Here is the error JSON payload:

{
  "code":-1121,
  "msg":"Invalid symbol."
}

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

-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 INVALID_MESSAGE

-1014 UNKNOWN_ORDER_COMPOSITION

-1015 TOO_MANY_ORDERS

-1016 SERVICE_SHUTTING_DOWN

-1020 UNSUPPORTED_OPERATION

-1021 INVALID_TIMESTAMP

-1022 INVALID_SIGNATURE

-1023 START_TIME_GREATER_THAN_END_TIME

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

20xx - Processing Issues

-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

-2018 BALANCE_NOT_SUFFICIENT

-2019 MARGIN_NOT_SUFFICIEN

-2020 UNABLE_TO_FILL

-2021 ORDER_WOULD_IMMEDIATELY_TRIGGER

-2022 REDUCE_ONLY_REJECT

-2023 USER_IN_LIQUIDATION

-2024 POSITION_NOT_SUFFICIENT

-2025 MAX_OPEN_ORDER_EXCEEDED

-2026 REDUCE_ONLY_ORDER_TYPE_NOT_SUPPORTED

-2027 MAX_LEVERAGE_RATIO

-2028 MIN_LEVERAGE_RATIO

40xx - Filters and other Issues

-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

-4007 STOP_PRICE_GREATER_THAN_MAX_PRICE

-4008 TICK_SIZE_LESS_THAN_ZERO

-4009 MAX_PRICE_LESS_THAN_MIN_PRICE

-4010 MAX_QTY_LESS_THAN_MIN_QTY

-4011 STEP_SIZE_LESS_THAN_ZERO

-4012 MAX_NUM_ORDERS_LESS_THAN_ZERO

-4013 PRICE_LESS_THAN_MIN_PRICE

-4014 PRICE_NOT_INCREASED_BY_TICK_SIZE

-4015 INVALID_CL_ORD_ID_LEN

-4016 PRICE_HIGHTER_THAN_MULTIPLIER_UP

-4017 MULTIPLIER_UP_LESS_THAN_ZERO

-4018 MULTIPLIER_DOWN_LESS_THAN_ZERO

-4019 COMPOSITE_SCALE_OVERFLOW

-4020 TARGET_STRATEGY_INVALID

-4021 INVALID_DEPTH_LIMIT

-4022 WRONG_MARKET_STATUS

-4023 QTY_NOT_INCREASED_BY_STEP_SIZE

-4024 PRICE_LOWER_THAN_MULTIPLIER_DOWN

-4025 MULTIPLIER_DECIMAL_LESS_THAN_ZERO

-4026 COMMISSION_INVALID

-4027 INVALID_ACCOUNT_TYPE

-4028 INVALID_LEVERAGE

-4029 INVALID_TICK_SIZE_PRECISION

-4030 INVALID_STEP_SIZE_PRECISION

-4031 INVALID_WORKING_TYPE

-4032 EXCEED_MAX_CANCEL_ORDER_SIZE

-4033 INSURANCE_ACCOUNT_NOT_FOUND

-4044 INVALID_BALANCE_TYPE

-4045 MAX_STOP_ORDER_EXCEEDED

-4046 NO_NEED_TO_CHANGE_MARGIN_TYPE

-4047 THERE_EXISTS_OPEN_ORDERS

-4048 THERE_EXISTS_QUANTITY

-4049 ADD_ISOLATED_MARGIN_REJECT

-4050 CROSS_BALANCE_INSUFFICIENT

-4051 ISOLATED_BALANCE_INSUFFICIENT

-4052 NO_NEED_TO_CHANGE_AUTO_ADD_MARGIN

-4053 AUTO_ADD_CROSSED_MARGIN_REJECT

-4054 ADD_ISOLATED_MARGIN_NO_POSITION_REJECT

-4055 AMOUNT_MUST_BE_POSITIVE

-4056 INVALID_API_KEY_TYPE

-4057 INVALID_RSA_PUBLIC_KEY

-4058 MAX_PRICE_TOO_LARGE

-4059 NO_NEED_TO_CHANGE_POSITION_SIDE

-4060 INVALID_POSITION_SIDE

-4061 POSITION_SIDE_NOT_MATCH

-4062 REDUCE_ONLY_CONFLICT

-4067 POSITION_SIDE_CHANGE_EXISTS_OPEN_ORDERS

-4068 POSITION_SIDE_CHANGE_EXISTS_QUANTITY

-4082 INVALID_BATCH_PLACE_ORDER_SIZE

-4083 PLACE_BATCH_ORDERS_FAIL

-4084 UPCOMING_METHOD

-4086 INVALID_PRICE_SPREAD_THRESHOLD

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, clientOrderId, origClientOrderId) could not be found
"Duplicate order sent." The clientOrderId 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
"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
"This action disabled is on this account." Contact customer support; some actions have been disabled on the account.
"Unsupported order combination" The orderType, timeInForce, stopPrice 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 origClientOrderId and orderId." No origClientOrderId or orderId was sent in.
"Order would immediately match and take." GTX order would immediately match and trade, and not be a pure maker order.

-9xxx 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: LOT_SIZE" quantity is too high, too low, and/or not following the step size rule for the symbol.
"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_NUM_ORDERS" Account has too many open orders on 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.