Skip to main content

Get Order History

Query order history. As order creation/cancellation is asynchronous, the data returned from this endpoint may delay. If you want to get real-time order information, you could query this endpoint or rely on the websocket stream (recommended).

Normal account covers: USDT perpetual / Inverse contract

info
  • The orders in the last 7 days: supports querying all statuses
  • The orders beyond 7 days: supports querying filled orders
  • If no time is specified, the data from the last 7 days will be returned by default, You can query by symbol, baseCoin, orderId and orderLinkId, and if you pass multiple params, the system will process them according to this priority: orderId > orderLinkId > symbol.

HTTP Request

GET /cloud/trade/v3/order/history

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type
  • Normal account: linear, inverse, spot
symbolfalsestringSymbol name
orderIdfalsestringOrder ID
orderLinkIdfalsestringUser customised order ID
orderFilterfalsestringOrder: active order, StopOrder: conditional order
  • Others: all kinds of orders by default
orderStatusfalsestring
  • Classic spot: not supported
  • Others: return all status orders if not passed
startTimefalseintegerThe start timestamp (ms)
  • startTime and endTime must be passed together
  • If not passed, query the past 7 days data by default
  • For each request, startTime and endTime interval should be less then 7 days
endTimefalseintegerThe end timestamp (ms)
  • For each request, startTime and endTime interval should be less then 7 days
limitfalseintegerLimit for data size per page. [1, 50]. Default: 20
cursorfalsestringCursor. Use the nextPageCursor token from the response to retrieve the next page of the result set

Response Parameters

ParameterTypeComments
categorystringProduct type
listarrayObject
> orderIdstringOrder ID
> orderLinkIdstringUser customised order ID
> symbolstringSymbol name
> pricestringOrder price
> qtystringOrder qty
> sidestringSide. Buy,Sell
> positionIdxintegerPosition index. Used to identify positions in different position modes
> orderStatusstringOrder status
> cancelTypestringCancel type
> rejectReasonstringReject reason.
> avgPricestringAverage filled price. If unfilled, it is ""
> leavesQtystringThe remaining qty not executed.
> leavesValuestringThe estimated value not executed.
> cumExecQtystringCumulative executed order qty
> cumExecValuestringCumulative executed order value.
> cumExecFeestringCumulative executed trading fee.
> timeInForcestringTime in force
> orderTypestringOrder type. Market,Limit. For TP/SL order, it means the order type after triggered
> stopOrderTypestringStop order type
> orderIvstringImplied volatility
> triggerPricestringTrigger price. If stopOrderType=TrailingStop, it is activate price. Otherwise, it is trigger price
> takeProfitstringTake profit price
> stopLossstringStop loss price
> tpslModestringTP/SL mode, Full: entire position for TP/SL. Partial: partial position tp/sl.
> tpLimitPricestringThe limit order price when take profit price is triggered
> slLimitPricestringThe limit order price when stop loss price is triggered
> tpTriggerBystringThe price type to trigger take profit
> slTriggerBystringThe price type to trigger stop loss
> triggerDirectionintegerTrigger direction. 1: rise, 2: fall
> triggerBystringThe price type of trigger price
> lastPriceOnCreatedstringLast price when place the order
> reduceOnlybooleanReduce only. true means reduce position size
> closeOnTriggerbooleanClose on trigger.
> placeTypestringPlace type
> createdTimestringOrder created timestamp (ms)
> updatedTimestringOrder updated timestamp (ms)
nextPageCursorstringRefer to the cursor request parameter

Request Example

GET /cloud/trade/v3/order/history?category=linear&limit=1 HTTP/1.1
Host: openapi-testnet.zoomex.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672221263407
X-BAPI-RECV-WINDOW: 5000

Response Example

{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"orderId": "14bad3a1-6454-43d8-bcf2-5345896cf74d",
"orderLinkId": "YLxaWKMiHU",
"symbol": "BTCUSDT",
"price": "26864.40",
"qty": "0.003",
"side": "Buy",
"isLeverage": "",
"positionIdx": 1,
"orderStatus": "Cancelled",
"cancelType": "UNKNOWN",
"rejectReason": "EC_PostOnlyWillTakeLiquidity",
"avgPrice": "0",
"leavesQty": "0.000",
"leavesValue": "0",
"cumExecQty": "0.000",
"cumExecValue": "0",
"cumExecFee": "0",
"timeInForce": "PostOnly",
"orderType": "Limit",
"stopOrderType": "UNKNOWN",
"orderIv": "",
"triggerPrice": "0.00",
"takeProfit": "0.00",
"stopLoss": "0.00",
"tpTriggerBy": "UNKNOWN",
"slTriggerBy": "UNKNOWN",
"triggerDirection": 0,
"triggerBy": "UNKNOWN",
"lastPriceOnCreated": "0.00",
"reduceOnly": false,
"closeOnTrigger": false,
"tpslMode": "",
"tpLimitPrice": "",
"slLimitPrice": "",
"placeType": "",
"createdTime": "1684476068369",
"updatedTime": "1684476068372"
}
],
"nextPageCursor": "page_token%3D39380%26",
"category": "linear"
},
"retExtInfo": {},
"time": 1684766282976
}