Skip to main content

Get Order History

Description

Get previous futures orders. Orders that are completely canceled (no transaction has occurred) initiated through the API can only be queried for 4 hours.

HTTP Request

GET /v3/trade/order/history

Request Parameters

ParameterRequiredTypeDescription
symbolNoStringA trading pair, consisting of two currencies: base currency and quote currency
sideNoStringTrade Side, Enumerate BUY and SELL
ordIdNoStringOrder ID
clOrdIdNoStringClient Order ID as assigned by the client
stateNoStringOrder Status: Enumerate FILLED, PARTIALLY_CANCELED, CANCELED
typeNoStringOrder type; various order types are supported.
sTimeNoStringStarting time of the history, Unix timestamp format in milliseconds. The default is the last 90 days
eTimeNoStringEnding time of the history, Unix timestamp format in milliseconds. The default is the last 90 days
fromNoLongIt is ordId. ID for the query starts at 0 by default.
limitNoIntegerPagination size defaults to 10, with a maximum limit of 100.
directNoStringEnumerate: PREV, NEXT, The default is NEXT

Response Parameters

ParameterTypeDescription
symbolStringA trading pair, consisting of two currencies: base currency and quote currency
sideStringEnumerate: BUY and SELL
typeStringOrder type; enumerate MARKET, LIMIT, and LIMIT_MAKER
ordIdStringOrder ID
clOrdIdStringClient Order ID as assigned by the client
mgnModeStringMargin Mode, Enumerate: ISOLATED, CROSS
posSideStringPosition side LONG SHORT BOTH
pxStringPrice
szStringOrder size, specifically in Cont
stateStringOrder Status: Enumerate FILLED, PARTIALLY_CANCELED, CANCELED
cancelReasonStringUSER_CANCEL_ORDER_ACTION, LIMIT_MAKER_ORDER_INCORRECT_PRICE_CONDITION, LIMIT_MATCH_IOC_OR_FOK_ORDER_PRICE_CANNOT_MATCH, LIMIT_MATCH_FOK_ORDER_MAKER_INSUFFICIENT_AVAILABLE_QUANTITY, LIMIT_MATCH_IOC_ORDER_CANNOT_FILLED, LIMIT_MATCH_ORDER_TAKER_SELF_TRADE,MARKET_ORDER_NO_OTHER_SIDE_ORDER, INVALID_PARAM_WHEN_PLACE_ORDER, INVALID_ORDER_TYPE_WHEN_PLACE_ORDER, INVALID_SEQUENCE_PLACE_ORDER_AFTER_CANCEL_SAME_ORDER, MATCH_SYMBOL_TRADE_LIMIT_NOT_EXIST, EXCEED_SLIPPAGE_TOLERANCE, OUT_OF_RANGE_LIMIT_PRICE,NO_MARGIN_QUANTITY_GREAT_THAN_POSITION, LIMIT_MATCH_ORDER_ONLY_SELF_TRADE, FL_CANCEL_ORDER_ACTION, RISK_CANCEL_ORDER_ACTION, SYS_CANCEL_ORDER_ACTION
sourceStringOrder Source: Enumerate WEB, APP, API, SMART, WEB_MARGIN, APP_IOS, APP_ANDROID, APP_IOS_MARGIN, APP_ANDROID_MARGIN, API_MARGIN, SMART_MARGIN, WS, WS_MARGIN, GRID, GRID_MARGIN, SYSTEM, COPY_TRADING, TRIGGER, LIQUIDATION, ADL, TRIAL, MARGIN_FL, MARGIN_FL_OFFLINE
reduceOnlyBooleanReduce only
timeInForceStringEnumerate FOK, IOC, and GTC. It is an optional field with GTC by default.
avgPxStringAverage execution price
execQtyStringCumulative execution amount
execAmtStringCumulative execution value
feeCcyStringName of the currency used for trading fees
feeAmtStringCumulative amount of trading fee
deductCcyStringName of the currency used to deduct trading fees
deductAmtStringCumulative amount of trading fee deducted
stpModeStringEnumerate
- EXPIRE_TAKER
- EXPIRE_MAKER
- EXPIRE_BOTH
Default is NONE
cTimeStringOrder creation time with a UTC timestamp (MS)
uTimeStringOrder update time with a UTC timestamp (MS)

Request Example

{
"symbol": "BTC_USDT_PERP",
"direct": "NEXT",
"From": "0",
"limit": 100,
"sTime": "1719971873000",
"eTime": "1719973853000"
}

Response Example

{
"code": 200,
"data": [
{
"avgPx": "0.6272",
"cTime": "1719973768748",
"cancelReason": "",
"clOrdId": "polo331380922769473536",
"deductAmt": "0",
"deductCcy": "0",
"execAmt": "1.8816",
"execQty": "3",
"feeAmt": "0.00009408",
"feeCcy": "USDT",
"lever": "20",
"mgnMode": "CROSS",
"posSide": "BOTH",
"ordId": "331380922769473536",
"px": "60000",
"reduceOnly": "false",
"side": "BUY",
"slPx": "",
"slTrgPx": "",
"slTrgPxType": "",
"source": "WEB",
"state": "FILLED",
"stpMode": "NONE",
"symbol": "BTC_USDT_PERP",
"sz": "3",
"timeInForce": "GTC",
"tpPx": "",
"tpTrgPx": "",
"tpTrgPxType": "",
"type": "LIMIT",
"uTime": "1719973768764"
},
{
"avgPx": "0.6272",
"cTime": "1719973712694",
"cancelReason": "",
"clOrdId": "12345",
"deductAmt": "0",
"deductCcy": "0",
"execAmt": "1.8816",
"execQty": "3",
"feeAmt": "0.00009408",
"feeCcy": "USDT",
"lever": "20",
"mgnMode": "CROSS",
"posSide": "BOTH",
"ordId": "331380687661957120",
"px": "0",
"reduceOnly": "true",
"side": "BUY",
"slPx": "",
"slTrgPx": "",
"slTrgPxType": "",
"source": "API",
"state": "FILLED",
"stpMode": "NONE",
"symbol": "BTC_USDT_PERP",
"sz": "3",
"timeInForce": "GTC",
"tpPx": "",
"tpTrgPx": "",
"tpTrgPxType": "",
"type": "MARKET",
"uTime": "1719973712703"
},
{
"avgPx": "0",
"cTime": "1719973298692",
"cancelReason": "ORDER_SOURCE_API",
"clOrdId": "4251fe5c-2b1e-4abd-b9b2-e7c713435653",
"deductAmt": "0",
"deductCcy": "0",
"execAmt": "0",
"execQty": "0",
"feeAmt": "0",
"feeCcy": "",
"lever": "20",
"mgnMode": "CROSS",
"posSide": "BOTH",
"ordId": "331378951211712512",
"px": "60000",
"reduceOnly": "false",
"side": "SELL",
"slPx": "",
"slTrgPx": "",
"slTrgPxType": "",
"source": "API",
"state": "CANCELED",
"stpMode": "EXPIRE_TAKER",
"symbol": "BTC_USDT_PERP",
"sz": "2",
"timeInForce": "GTC",
"tpPx": "",
"tpTrgPx": "",
"tpTrgPxType": "",
"type": "LIMIT",
"uTime": "1719973526115"
},
{
"avgPx": "0",
"cTime": "1719973298689",
"cancelReason": "ORDER_SOURCE_API",
"clOrdId": "9e36e89c-6cab-45c6-9c8a-245b7547601a",
"deductAmt": "0",
"deductCcy": "0",
"execAmt": "0",
"execQty": "0",
"feeAmt": "0",
"feeCcy": "",
"lever": "20",
"mgnMode": "CROSS",
"posSide": "BOTH",
"ordId": "331378951199129601",
"px": "60000",
"reduceOnly": "false",
"side": "SELL",
"slPx": "",
"slTrgPx": "",
"slTrgPxType": "",
"source": "API",
"state": "CANCELED",
"stpMode": "EXPIRE_TAKER",
"symbol": "BTC_USDT_PERP",
"sz": "2",
"timeInForce": "GTC",
"tpPx": "",
"tpTrgPx": "",
"tpTrgPxType": "",
"type": "LIMIT",
"uTime": "1719973454788"
}
],
"msg": "Success"
}