Skip to main content

Get Historical Orders

Description​

Query historical orders (completed orders), supports multi-condition filtering, data may have a delay of 5 seconds to 1 minute.

HTTP Request​

  • POST /api/v3/order/user/history
  • Supported Products: spot / linear
  • Rate Limit: 10 requests per second per UID

Request Parameters​

FieldTypeRequiredDescription
categorystringYesspot for spot or linear for futures.
startTimeLongYesStart timestamp in milliseconds. The time range can span up to 90 days.
endTimeLongYesEnd timestamp in milliseconds. The time range can span up to 90 days.
pageSizeintegerYesRecords per page. Default: 20. Maximum: 100.
pageIndexintegerYesPage number. Use cursor for subsequent pages to improve performance.
orderFilterstringNoComma-separated order types: LIMIT, MARKET, PLAN_LIMIT, PLAN_MARKET, OCO, PROFITLOSS_LIMIT, PROFITLOSS_MARKET.
symbolstringNoContract/trading pair name
baseCoinstringNoBase asset, such as BTC.
sidestringNoOrder side, BUY or SELL.
sortTypestringNoSort field, createTime or updateTime.
orderIdstringNoOrder ID.
orderLinkIdstringNoExternal order ID.
cursorstringNoPagination cursor. Leave empty on the first request and use the returned cursor for the next page.

Response Parameters​

FieldTypeDescription
symbolstringContract or trading pair name (for example, BTC-USDT).
symbolIdintegerUnique contract or trading pair ID.
orderIdstringUnique order ID.
leverageintegerLeverage multiplier.
baseCoinstringBase asset.
sidestringOrder side, BUY or SELL.
orderQtystringOrder quantity.
orderStatusstring5 rejected, 7 canceled, 9 filled, 10 deactivated or expired, 11 canceled after a partial fill.
createdTimeLongOrder creation timestamp in milliseconds (UTC+8).
updatedTimeLongLast update timestamp in milliseconds (UTC+8).
cumExecQtystringCumulative filled quantity.
cumExecFeestringCumulative trading fee.
executedAmountstringExecuted amount.
orderValuestringOrder value.
reduceOnlyinteger1 for reduce-only, 0 otherwise.
accountModestringCROSS for cross margin, ISOLATED for isolated margin.
amountstringOrder amount.
avgPricestringAverage execution price.
tpLimitPricestringTake-profit limit price.
isLiquidbooleantrue for a liquidation order, false for an ordinary order.
tpTriggerPricestringTake-profit trigger price.
slTriggerPricestringStop-loss trigger price.
triggerPricestringTrigger price.
triggerTimeLongTrigger timestamp in milliseconds.
categorystringspot for spot or linear for futures.
stopOrderTypeinteger1 futures conditional, 2 position take-profit, 3 position stop-loss, 6 partial take-profit, 7 partial stop-loss, 8 spot conditional, 10 spot OCO.
slLimitPricestringStop-loss limit price.
businessOrderTypestringLIMIT / MARKET / PLAN_LIMIT / PLAN_MARKET / OCO / PROFITLOSS_LIMIT / PROFITLOSS_MARKET
orderPricestringOrder price.
cumClosedPnlstringCumulative closed profit and loss.
actionstring1 open long, 2 open short, 3 close long, 4 close short.
settleCoinstringSettlement asset.
isSolatedinteger1 for isolated margin, 0 for cross margin.
rejectReasonstringOrder rejection reason.

Request Example​

POST /api/v3/order/user/history HTTP/1.1
Host: openapi.lbank.com
Content-Type: application/json
ex-api-key: <your_api_key>
ex-timestamp: <current_unix_timestamp_ns>
ex-nonce: <unique_random_hex>
ex-signature: <your_signature>
ex-client-type: API

{
"startTime": 1793241426035,
"endTime": 1793846226035,
"symbol": "BTCUSDT",
"category": "linear",
"pageIndex": 1,
"pageSize": 10
}

Response Example​

{
"code": 200,
"message": "success",
"data": {
"itemList": [
{
"symbol": "BTCUSDT",
"symbolId": 10013,
"orderId": "86f30462-0a11-490e-8b9a-5386daf9fc41",
"orderType": "LIMIT",
"orderPrice": "1.3",
"side": "SELL",
"orderQty": "25.13"
}
],
"cursor": "",
"sumCount": 0,
"resultCode": 0,
"resultMessage": ""
},
"extras": null
}