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
| Field | Type | Required | Description |
|---|---|---|---|
category | string | Yes | spot for spot or linear for futures. |
startTime | Long | Yes | Start timestamp in milliseconds. The time range can span up to 90 days. |
endTime | Long | Yes | End timestamp in milliseconds. The time range can span up to 90 days. |
pageSize | integer | Yes | Records per page. Default: 20. Maximum: 100. |
pageIndex | integer | Yes | Page number. Use cursor for subsequent pages to improve performance. |
orderFilter | string | No | Comma-separated order types: LIMIT, MARKET, PLAN_LIMIT, PLAN_MARKET, OCO, PROFITLOSS_LIMIT, PROFITLOSS_MARKET. |
symbol | string | No | Contract/trading pair name |
baseCoin | string | No | Base asset, such as BTC. |
side | string | No | Order side, BUY or SELL. |
sortType | string | No | Sort field, createTime or updateTime. |
orderId | string | No | Order ID. |
orderLinkId | string | No | External order ID. |
cursor | string | No | Pagination cursor. Leave empty on the first request and use the returned cursor for the next page. |
Response Parameters
| Field | Type | Description |
|---|---|---|
symbol | string | Contract or trading pair name (for example, BTC-USDT). |
symbolId | integer | Unique contract or trading pair ID. |
orderId | string | Unique order ID. |
leverage | integer | Leverage multiplier. |
baseCoin | string | Base asset. |
side | string | Order side, BUY or SELL. |
orderQty | string | Order quantity. |
orderStatus | string | 5 rejected, 7 canceled, 9 filled, 10 deactivated or expired, 11 canceled after a partial fill. |
createdTime | Long | Order creation timestamp in milliseconds (UTC+8). |
updatedTime | Long | Last update timestamp in milliseconds (UTC+8). |
cumExecQty | string | Cumulative filled quantity. |
cumExecFee | string | Cumulative trading fee. |
executedAmount | string | Executed amount. |
orderValue | string | Order value. |
reduceOnly | integer | 1 for reduce-only, 0 otherwise. |
accountMode | string | CROSS for cross margin, ISOLATED for isolated margin. |
amount | string | Order amount. |
avgPrice | string | Average execution price. |
tpLimitPrice | string | Take-profit limit price. |
isLiquid | boolean | true for a liquidation order, false for an ordinary order. |
tpTriggerPrice | string | Take-profit trigger price. |
slTriggerPrice | string | Stop-loss trigger price. |
triggerPrice | string | Trigger price. |
triggerTime | Long | Trigger timestamp in milliseconds. |
category | string | spot for spot or linear for futures. |
stopOrderType | integer | 1 futures conditional, 2 position take-profit, 3 position stop-loss, 6 partial take-profit, 7 partial stop-loss, 8 spot conditional, 10 spot OCO. |
slLimitPrice | string | Stop-loss limit price. |
businessOrderType | string | LIMIT / MARKET / PLAN_LIMIT / PLAN_MARKET / OCO / PROFITLOSS_LIMIT / PROFITLOSS_MARKET |
orderPrice | string | Order price. |
cumClosedPnl | string | Cumulative closed profit and loss. |
action | string | 1 open long, 2 open short, 3 close long, 4 close short. |
settleCoin | string | Settlement asset. |
isSolated | integer | 1 for isolated margin, 0 for cross margin. |
rejectReason | string | Order 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
}