User
Spot Account/Trade
Order Book
Response:
[
[
2266452198,
"BTCUSDT",
"BTC",
"USDT",
"b",
23091.44,
1,
0.99697,
0.00303,
0.1,
0.1,
"2023-01-01T07:25:46.602Z",
"Executing"
]
]
GET /user/orderbook
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES |
Trades
Response:
[
[
2266494835,
35167177,
"BTCUSDT",
"BTC",
"USDT",
"s",
23091.44,
0.00921,
0.21267216,
"2023-01-01T07:27:16.795Z"
],
[
2266452198,
35168294,
"BTCUSDT",
"BTC",
"USDT",
"b",
23091.44,
0.09859,
0.00009859,
"2023-01-01T07:29:24.660Z"
]
]
GET /user/trades
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES |
Orders
Response:
[
[
2266494835,
"BTCUSDT",
"s",
21937.53,
0.00921,
0,
0.00921,
"Filled",
"2023-01-01T07:27:16.795Z"
]
]
GET /user/orders
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES |
New Order
Response ACK:
{
"symbol": "BTCUSDT",
"orderId": 28,
"orderListId": -1, //Unless OCO, value will be -1
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"transactTime": 1507725176595
}
Response RESULT:
{
"symbol": "BTCUSDT",
"orderId": 28,
"orderListId": -1, //Unless OCO, value will be -1
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"transactTime": 1507725176595,
"price": "0.00000000",
"origQty": "10.00000000",
"executedQty": "10.00000000",
"cummulativeQuoteQty": "10.00000000",
"status": "FILLED",
"timeInForce": "GTC",
"type": "MARKET",
"side": "SELL",
"strategyId": 1, // This is only visible if the field was populated on order placement.
"strategyType": 1000000, // This is only visible if the field was populated on order placement.
"workingTime": 1507725176595,
"selfTradePreventionMode": "NONE"
}
Response FULL:
{
"symbol": "BTCUSDT",
"orderId": 28,
"orderListId": -1, //Unless OCO, value will be -1
"clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
"transactTime": 1507725176595,
"price": "0.00000000",
"origQty": "10.00000000",
"executedQty": "10.00000000",
"cummulativeQuoteQty": "10.00000000",
"status": "FILLED",
"timeInForce": "GTC",
"type": "MARKET",
"side": "SELL",
"strategyId": 1, // This is only visible if the field was populated on order placement.
"strategyType": 1000000, // This is only visible if the field was populated on order placement.
"workingTime": 1507725176595,
"selfTradePreventionMode": "NONE",
"fills": [
{
"price": "4000.00000000",
"qty": "1.00000000",
"commission": "4.00000000",
"commissionAsset": "USDT",
"tradeId": 56
},
{
"price": "3999.00000000",
"qty": "5.00000000",
"commission": "19.99500000",
"commissionAsset": "USDT",
"tradeId": 57
},
{
"price": "3998.00000000",
"qty": "2.00000000",
"commission": "7.99600000",
"commissionAsset": "USDT",
"tradeId": 58
},
{
"price": "3997.00000000",
"qty": "1.00000000",
"commission": "3.99700000",
"commissionAsset": "USDT",
"tradeId": 59
},
{
"price": "3995.00000000",
"qty": "1.00000000",
"commission": "3.99500000",
"commissionAsset": "USDT",
"tradeId": 60
}
]
}
Send in a new order.
POST /api/v3/order (HMAC SHA256)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES | |
| side | ENUM | YES | |
| type | ENUM | YES | |
| timeInForce | ENUM | NO | |
| quantity | DECIMAL | NO | |
| quoteOrderQty | DECIMAL | NO | |
| price | DECIMAL | NO | |
| newClientOrderId | STRING | NO | A unique id among open orders.Automatically generated if not sent. |
| strategyId | INT | NO | |
| strategyType | INT | NO | The value cannot be less than 1000000. |
| stopPrice | DECIMAL | NO | Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. |
| trailingDelta | LONG | NO | Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. |
| icebergQty | DECIMAL | NO | Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order. |
| newOrderRespType | ENUM | NO | Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK. |
| selfTradePreventionMode | ENUM | NO | Set the response JSON. ACK, RESULT, or FULL; MARKET and LIMIT order types default to FULL, all other orders default to ACK. |
| selfTradePreventionMode | ENUM | NO | The allowed enums is dependent on what is configured on the symbol. |
| recvWindow | LONG | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |
Additional mandatory parameters based on type:
| Name | Additional mandatory parameters |
|---|---|
| LIMIT | timeInForce, quantity, price |
| MARKET | quantity or quoteOrderQty |
| STOP_LOSS | quantity, stopPrice or trailingDelta |
| STOP_LOSS_LIMIT | timeInForce, quantity, price, stopPrice or trailingDelta |
| TAKE_PROFIT | quantity, stopPrice or trailingDelta |
| TAKE_PROFIT_LIMIT | timeInForce, quantity, price, stopPrice or trailingDelta |
| LIMIT_MAKER | quantity, price |
Other info:
LIMIT_MAKERareLIMITorders that will be rejected if they would immediately match and trade as a taker.STOP_LOSSandTAKE_PROFITwill execute aMARKETorder when the stopPrice is reached.Any
LIMITorLIMIT_MAKERtype order can be made an iceberg order by sending an icebergQty.Any order with an
icebergQtyMUST havetimeInForceset toGTC.MARKETorders using thequantityfield specifies the amount of the base asset the user wants to buy or sell at the market price.- For example, sending a MARKET order on BTCUSDT will specify how much BTC the user is buying or selling.
MARKETorders usingquoteOrderQtyspecifies the amount the user wants to spend (when buying) or receive (when selling) the quote asset; the correctquantitywill be determined based on the market liquidity andquoteOrderQty.- Using BTCUSDT as an example:
- On the
BUYside, the order will buy as many BTC asquoteOrderQtyUSDT can. - On the
SELLside, the order will sell as much BTC needed to receivequoteOrderQtyUSDT.
- On the
- Using BTCUSDT as an example:
MARKETorders usingquoteOrderQtywill not breakLOT_SIZEfilter rules; the order will execute aquantitythat will have the notional value as close as possible toquoteOrderQty.same
newClientOrderIdcan be accepted only when the previous one is filled, otherwise the order will be rejected.For
STOP_LOSS,STOP_LOSS_LIMIT,TAKE_PROFIT_LIMITandTAKE_PROFITorders,trailingDeltacan be combined withstopPrice.
Trigger order price rules against market price for both MARKET and LIMIT versions:
- Price above market price:
STOP_LOSS BUY,TAKE_PROFITSELL - Price below market price:
STOP_LOSS SELL,TAKE_PROFITBUY
Cancel Order (TRADE)
Response:
{
"symbol": "LTCBTC",
"origClientOrderId": "myOrder1",
"orderId": 4,
"orderListId": -1, //Unless part of an OCO, the value will always be -1.
"clientOrderId": "cancelMyOrder1",
"price": "2.00000000",
"origQty": "1.00000000",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"selfTradePreventionMode": "NONE"
}
DELETE /api/v3/order (HMAC SHA256) Cancel an active order.
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 | LONG | NO | The value cannot be greater than 60000 |
| symtimestampbol | LONG | YES |
Either orderId or origClientOrderId must be sent. If both orderId and origClientOrderId are provided, orderId takes precedence.
Cancel all Open Orders on a Symbol (TRADE)
Response:
[
{
"symbol": "BTCUSDT",
"origClientOrderId": "E6APeyTJvkMvLMYMqu1KQ4",
"orderId": 11,
"orderListId": -1,
"clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx",
"price": "0.089853",
"origQty": "0.178622",
"executedQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"selfTradePreventionMode": "NONE"
},
{
"symbol": "BTCUSDT",
"origClientOrderId": "A3EF2HCwxgZPFMrfwbgrhv",
"orderId": 13,
"orderListId": -1,
"clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx",
"price": "0.090430",
"origQty": "0.178622",
"executedQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"selfTradePreventionMode": "NONE"
},
{
"orderListId": 1929,
"contingencyType": "OCO",
"listStatusType": "ALL_DONE",
"listOrderStatus": "ALL_DONE",
"listClientOrderId": "2inzWQdDvZLHbbAmAozX2N",
"transactionTime": 1585230948299,
"symbol": "BTCUSDT",
"orders": [
{
"symbol": "BTCUSDT",
"orderId": 20,
"clientOrderId": "CwOOIPHSmYywx6jZX77TdL"
},
{
"symbol": "BTCUSDT",
"orderId": 21,
"clientOrderId": "461cPg51vQjV3zIMOXNz39"
}
],
"orderReports": [
{
"symbol": "BTCUSDT",
"origClientOrderId": "CwOOIPHSmYywx6jZX77TdL",
"orderId": 20,
"orderListId": 1929,
"clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx",
"price": "0.668611",
"origQty": "0.690354",
"executedQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "STOP_LOSS_LIMIT",
"side": "BUY",
"stopPrice": "0.378131",
"icebergQty": "0.017083",
"selfTradePreventionMode": "NONE"
},
{
"symbol": "BTCUSDT",
"origClientOrderId": "461cPg51vQjV3zIMOXNz39",
"orderId": 21,
"orderListId": 1929,
"clientOrderId": "pXLV6Hz6mprAcVYpVMTGgx",
"price": "0.008791",
"origQty": "0.690354",
"executedQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "BUY",
"icebergQty": "0.639962",
"selfTradePreventionMode": "NONE"
}
]
}
]
DELETE /api/v3/openOrders Cancels all active orders on a symbol.
This includes OCO orders.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES | |
| recvWindow | LONG | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |
Query Order (USER_DATA)
Response:
{
"symbol": "LTCBTC",
"orderId": 1,
"orderListId": -1, //Unless OCO, value will be -1
"clientOrderId": "myOrder1",
"price": "0.1",
"origQty": "1.0",
"executedQty": "0.0",
"cummulativeQuoteQty": "0.0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.0",
"icebergQty": "0.0",
"time": 1499827319559,
"updateTime": 1499827319559,
"isWorking": true,
"workingTime": 1499827319559,
"origQuoteOrderQty": "0.000000",
"selfTradePreventionMode": "NONE",
"preventedMatchId": 0, // This field only appears if the order expired due to STP.
"preventedQuantity": "1.200000" // This field only appears if the order expired due to STP.
}
GET /api/v3/order (HMAC SHA256)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES | |
| orderId | LONG | NO | |
| origClientOrderId | STRING | NO | |
| recvWindow | LONG | NO | The value cannot be greater than 60000 |
| symbol | LONG | YES |
Notes:
- Either
orderIdororigClientOrderIdmust be sent. - For some historical orders
cummulativeQuoteQtywill be < 0, meaning the data is not available at this time.
Cancel an Existing Order and Send a New Order (TRADE)
Response SUCCESS:
//Both the cancel order placement and new order placement succeeded.
{
"cancelResult": "SUCCESS",
"newOrderResult": "SUCCESS",
"cancelResponse": {
"symbol": "BTCUSDT",
"origClientOrderId": "DnLo3vTAQcjha43lAZhZ0y",
"orderId": 9,
"orderListId": -1,
"clientOrderId": "osxN3JXAtJvKvCqGeMWMVR",
"price": "0.01000000",
"origQty": "0.000100",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "SELL",
"selfTradePreventionMode": "NONE"
},
"newOrderResponse": {
"symbol": "BTCUSDT",
"orderId": 10,
"orderListId": -1,
"clientOrderId": "wOceeeOzNORyLiQfw7jd8S",
"transactTime": 1652928801803,
"price": "0.02000000",
"origQty": "0.040000",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"workingTime": 1669277163808,
"fills": [],
"selfTradePreventionMode": "NONE"
}
}
Response when Cancel Order Fails with STOP_ON_FAILURE:
{
"code": -2022,
"msg": "Order cancel-replace failed.",
"data": {
"cancelResult": "FAILURE",
"newOrderResult": "NOT_ATTEMPTED",
"cancelResponse": {
"code": -2011,
"msg": "Unknown order sent."
},
"newOrderResponse": null
}
}
Response when Cancel Order Succeeds but New Order Placement Fails:
{
"code": -2021,
"msg": "Order cancel-replace partially failed.",
"data": {
"cancelResult": "SUCCESS",
"newOrderResult": "FAILURE",
"cancelResponse": {
"symbol": "BTCUSDT",
"origClientOrderId": "86M8erehfExV8z2RC8Zo8k",
"orderId": 3,
"orderListId": -1,
"clientOrderId": "G1kLo6aDv2KGNTFcjfTSFq",
"price": "0.006123",
"origQty": "10000.000000",
"executedQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "SELL",
"selfTradePreventionMode": "NONE"
},
"newOrderResponse": {
"code": -2010,
"msg": "Order would immediately match and take."
}
}
}
Response when Cancel Order fails with ALLOW_FAILURE:
{
"code": -2021,
"msg": "Order cancel-replace partially failed.",
"data": {
"cancelResult": "FAILURE",
"newOrderResult": "SUCCESS",
"cancelResponse": {
"code": -2011,
"msg": "Unknown order sent."
},
"newOrderResponse": {
"symbol": "BTCUSDT",
"orderId": 11,
"orderListId": -1,
"clientOrderId": "pfojJMg6IMNDKuJqDxvoxN",
"transactTime": 1648540168818
}
}
}
Response when both Cancel Order and New Order Placement fail:
{
"code": -2022,
"msg": "Order cancel-replace failed.",
"data": {
"cancelResult": "FAILURE",
"newOrderResult": "FAILURE",
"cancelResponse": {
"code": -2011,
"msg": "Unknown order sent."
},
"newOrderResponse": {
"code": -2010,
"msg": "Order would immediately match and take."
}
}
}
POST /api/v3/order/cancelReplace
Cancels an existing order and places a new order on the same symbol.
Filters and Order Count are evaluated before the processing of the cancellation and order placement occurs.
A new order that was not attempted (i.e. when newOrderResult: NOT_ATTEMPTED), will still increase the order count by 1.
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES | |
| side | ENUM | YES | |
| type | ENUM | YES | |
| cancelReplaceMode | ENUM | YES | |
| timeInForce | ENUM | NO | |
| quantity | DECIMAL | NO | |
| price | DECIMAL | NO | |
| quoteOrcancelNewClientOrderIdderQty | STRING | NO | Used to uniquely identify this cancel. Automatically generated by default. |
| cancelOrigClientOrderId | STRING | NO | Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence. |
| cancelOrderId | LONG | NO | Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence. |
| newClientOrderId | STRING | NO | Used to identify the new order. |
| strategyId | INT | NO | |
| strategyType | INT | NO | The value cannot be less than 1000000. |
| stopPrice | DECIMAL | NO | |
| trailingDelta | LONG | NO | |
| stopPrice | DECIMAL | NO | |
| icebergQty | DECIMAL | NO | |
| newOrderRespType | ENUM | NO | |
| selfTradePreventionMode | ENUM | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |
Similar to POST /api/v3/order, additional mandatory parameters are determined by type.
Response format varies depending on whether the processing of the message succeeded, partially succeeded, or failed.
Current Open Orders (USER_DATA)
Response:
[
{
"symbol": "LTCBTC",
"orderId": 1,
"orderListId": -1, //Unless OCO, the value will always be -1
"clientOrderId": "myOrder1",
"price": "0.1",
"origQty": "1.0",
"executedQty": "0.0",
"cummulativeQuoteQty": "0.0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.0",
"icebergQty": "0.0",
"time": 1499827319559,
"updateTime": 1499827319559,
"isWorking": true,
"workingTime": 1499827319559,
"origQuoteOrderQty": "0.000000",
"selfTradePreventionMode": "NONE"
}
]
GET /api/v3/openOrders (HMAC SHA256)
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 | LONG | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |
- If the symbol is not sent, orders for all symbols will be returned in an array.
All Orders (USER_DATA)
Response:
[
{
"symbol": "LTCBTC",
"orderId": 1,
"orderListId": -1, //Unless OCO, the value will always be -1
"clientOrderId": "myOrder1",
"price": "0.1",
"origQty": "1.0",
"executedQty": "0.0",
"cummulativeQuoteQty": "0.0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": "0.0",
"icebergQty": "0.0",
"time": 1499827319559,
"updateTime": 1499827319559,
"isWorking": true,
"origQuoteOrderQty": "0.000000",
"workingTime": 1499827319559,
"selfTradePreventionMode": "NONE",
"preventedMatchId": 0, // This field only appears if the order expired due to STP.
"preventedQuantity": "1.200000" // This field only appears if the order expired due to STP.
}
]
GET /api/v3/allOrders (HMAC SHA256) Get all account orders; active, canceled, or filled.
Weight(IP): 10 with symbol
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES | |
| orderId | LONG | NO | |
| startTime | LONG | NO | |
| sendTimeymbol | LONG | NO | |
| limit | INT | NO | Default 500; max 1000. |
| recvWindow | LONG | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |
Notes:
- If
orderIdis set, it will get orders >= thatorderId. Otherwise most recent orders are returned. - For some historical orders
cummulativeQuoteQtywill be < 0, meaning the data is not available at this time. - If
startTimeand/orendTimeprovided,orderIdis not required.
New OCO (TRADE)
Response:
{
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
"transactionTime": 1563417480525,
"symbol": "LTCBTC",
"orders": [
{
"symbol": "LTCBTC",
"orderId": 2,
"clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos"
},
{
"symbol": "LTCBTC",
"orderId": 3,
"clientOrderId": "xTXKaGYd4bluPVp78IVRvl"
}
],
"orderReports": [
{
"symbol": "LTCBTC",
"orderId": 2,
"orderListId": 0,
"clientOrderId": "Kk7sqHb9J6mJWTMDVW7Vos",
"transactTime": 1563417480525,
"price": "0.000000",
"origQty": "0.624363",
"executedQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "STOP_LOSS",
"side": "BUY",
"stopPrice": "0.960664",
"workingTime": -1,
"selfTradePreventionMode": "NONE"
},
{
"symbol": "LTCBTC",
"orderId": 3,
"orderListId": 0,
"clientOrderId": "xTXKaGYd4bluPVp78IVRvl",
"transactTime": 1563417480525,
"price": "0.036435",
"origQty": "0.624363",
"executedQty": "0.000000",
"cummulativeQuoteQty": "0.000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "BUY",
"workingTime": 1563417480525,
"selfTradePreventionMode": "NONE"
}
]
}
POST /api/v3/order/oco (HMAC SHA256) Send in a new OCO
Weight(UID): 2 Weight(IP): 1
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| symbol | STRING | YES | |
| listClientOrderId | STRING | NO | A unique Id for the entire orderList |
| side | ENUM | YES | |
| quantity | DECIMAL | YES | |
| limitClientOrderId | STRING | NO | A unique Id for the limit order |
| limitStrategyId | INT | NO | |
| limitStrategyType | INT | NO | The value cannot be less than 1000000. |
| price | DECIMAL | YES | |
| limitIcebergQty | DECIMAL | NO | |
| trailingDelta | LONG | NO | |
| stopClientOrderId | STRING | NO | A unique Id for the stop loss/stop loss limit leg |
| stopPrice | DECIMAL | YES | |
| stopStrategyId | INT | NO | |
| stopStrategyType | INT | NO | The value cannot be less than 1000000. |
| stopLimitPrice | DECIMAL | NO | If provided, stopLimitTimeInForce is required. |
| stopIcebergQty | DECIMAL | NO | |
| stopLimitTimeInForce | ENUM | NO | Valid values are GTC/FOK/IOC |
| newOrderRespType | ENUM | NO | Set the response JSON. |
| selfTradePreventionMode | ENUM | NO | The allowed enums is dependent on what is configured on the symbol. |
| recvWindow | LONG | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |
Other Info:
- Price Restrictions:
SELL: Limit Price > Last Price > Stop PriceBUY: Limit Price < Last Price < Stop Price
- Quantity Restrictions:
- Both legs must have the same quantity
ICEBERGquantities however do not have to be the same.
- Order Rate Limit
OCOcounts as 2 orders against the order rate limit.
Cancel OCO (TRADE)
Response:
{
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "ALL_DONE",
"listOrderStatus": "ALL_DONE",
"listClientOrderId": "C3wyj4WVEktd7u9aVBRXcN",
"transactionTime": 1574040868128,
"symbol": "LTCBTC",
"orders": [
{
"symbol": "LTCBTC",
"orderId": 2,
"clientOrderId": "pO9ufTiFGg3nw2fOdgeOXa"
},
{
"symbol": "LTCBTC",
"orderId": 3,
"clientOrderId": "TXOvglzXuaubXAaENpaRCB"
}
],
"orderReports": [
{
"symbol": "LTCBTC",
"origClientOrderId": "pO9ufTiFGg3nw2fOdgeOXa",
"orderId": 2,
"orderListId": 0,
"clientOrderId": "unfWT8ig8i0uj6lPuYLez6",
"price": "1.00000000",
"origQty": "10.00000000",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "STOP_LOSS_LIMIT",
"side": "SELL",
"stopPrice": "1.00000000",
"selfTradePreventionMode": "NONE"
},
{
"symbol": "LTCBTC",
"origClientOrderId": "TXOvglzXuaubXAaENpaRCB",
"orderId": 3,
"orderListId": 0,
"clientOrderId": "unfWT8ig8i0uj6lPuYLez6",
"price": "3.00000000",
"origQty": "10.00000000",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT_MAKER",
"side": "SELL",
"selfTradePreventionMode": "NONE"
}
]
}
DELETE /api/v3/orderList (HMAC SHA256) Cancel an entire Order List.
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 | LONG | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |
Query OCO (USER_DATA)
Response:
{
"orderListId": 27,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "h2USkA5YQpaXHPIrkd96xE",
"transactionTime": 1565245656253,
"symbol": "LTCBTC",
"orders": [
{
"symbol": "LTCBTC",
"orderId": 4,
"clientOrderId": "qD1gy3kc3Gx0rihm9Y3xwS"
},
{
"symbol": "LTCBTC",
"orderId": 5,
"clientOrderId": "ARzZ9I00CPM8i3NhmU9Ega"
}
]
}
GET /api/v3/orderList (HMAC SHA256) Retrieves a specific OCO based on provided optional parameters
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 | LONG | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |
Query all OCO (USER_DATA)
Response:
[
{
"orderListId": 29,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "amEEAXryFzFwYF1FeRpUoZ",
"transactionTime": 1565245913483,
"symbol": "LTCBTC",
"orders": [
{
"symbol": "LTCBTC",
"orderId": 4,
"clientOrderId": "oD7aesZqjEGlZrbtRpy5zB"
},
{
"symbol": "LTCBTC",
"orderId": 5,
"clientOrderId": "Jr1h6xirOxgeJOUuYQS7V3"
}
]
},
{
"orderListId": 28,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "hG7hFNxJV6cZy3Ze4AUT4d",
"transactionTime": 1565245913407,
"symbol": "LTCBTC",
"orders": [
{
"symbol": "LTCBTC",
"orderId": 2,
"clientOrderId": "j6lFOfbmFMRjTYA7rRJ0LP"
},
{
"symbol": "LTCBTC",
"orderId": 3,
"clientOrderId": "z0KCjOdditiLS5ekAFtK81"
}
]
}
]
GET /api/v3/allOrderList (HMAC SHA256)
Retrieves all OCO based on provided optional parameters
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| fromId | LONG | NO | If supplied, neither startTime or endTime can be provided |
| startTime | LONG | NO | |
| endTime | LONG | NO | |
| limit | INT | NO | Default Value: 500; Max Value: 1000 |
| recvWindow | LONG | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |
Query Open OCO (USER_DATA)
Response:
[
{
"orderListId": 31,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "wuB13fmulKj3YjdqWEcsnp",
"transactionTime": 1565246080644,
"symbol": "LTCBTC",
"orders": [
{
"symbol": "LTCBTC",
"orderId": 4,
"clientOrderId": "r3EH2N76dHfLoSZWIUw1bT"
},
{
"symbol": "LTCBTC",
"orderId": 5,
"clientOrderId": "Cv1SnyPD3qhqpbjpYEHbd2"
}
]
}
]
GET /api/v3/openOrderList (HMAC SHA256)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| recvWindow | LONG | NO | The value cannot be greater than 60000 |
| timestamp | LONG | YES |