跳到主要内容

查询历史委托

描述

此接口用于查询历史委托的合约订单。通过API发起完全撤单(未发生成交)的订单,只支持查询4个小时

HTTP请求

GET /v3/trade/order/history

请求参数

参数是否必填类型描述
symbolString交易对。常用形式为“基础货币”+“报价货币”
sideString成交方向;枚举:BUYSELL
ordIdString订单的订单 ID
clOrdIdString用户自定义订单ID
stateString订单状态;枚举:FILLED 已成交、PARTIAL_CANCELED:部分成交已撤销、CANCELED:已撤销
typeString订单类型;枚举:MARKETLIMITLIMIT_MAKER
sTimeString查询开始时间,UNIX时间戳,以毫秒为单位。默认是最近90天
eTimeString查询结束时间,UNIX时间戳,以毫秒为单位。默认是最近90天
fromLongordId,查询的起始id,默认从0开始
limitInteger分页页面大小,默认为10,最大为100。
directString枚举:PREV, NEXT;默认是 NEXT

响应参数

参数类型描述
symbolString交易对。常用形式为“基础货币”+“报价货币”
sideString枚举:BUYSELL
typeString订单类型;枚举:MARKET, LIMIT, LIMIT_MAKER
ordIdString订单编号
clOrdIdString用户自定义订单ID
mgnModeString保证金模式;枚举:ISOLATED 逐仓,CROSS 全仓
posSideString持仓方向 LONG-多 或 SHORT-空, 单向持仓为BOTH
pxString委托价格
szString委托张数
stateString订单状态;枚举: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
reduceOnlyBoolean只减仓
timeInForceString枚举:FOKIOCGTC;可选,默认为 GTC
avgPxString平均成交价格
execQtyString累计成交数量
execAmtString累计成交金额
feeCcyString手续费币种名称
feeAmtString累计手续费数量
deductCcyString手续费抵扣币种名称
deductAmtString累计手续费抵扣数量
stpModeStringEnumerate
- EXPIRE_TAKER
- EXPIRE_MAKER
- EXPIRE_BOTH
默认为NONE
cTimeString订单创建时间, UTC时间戳(MS)
uTimeString订单更新时间, UTC时间戳(MS)

请求示例

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

响应示例

{
"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"
}