跳到主要内容

查询历史持仓

描述

查询用户历史持有的仓位信息。

HTTP请求

GET /v3/trade/position/history

请求参数

参数是否必填类型描述
symbolString按照交易对查询
mgnModeString仓位模式;枚举:ISOLATED 逐仓, CROSS 全仓
posSideString持仓方向, LONG-多 或 SHORT-空,单向持仓为BOTH
sTimeString查询开始时间,UNIX时间戳,以毫秒为单位。默认是最近90天
eTimeString查询结束时间,UNIX时间戳,以毫秒为单位。默认是最近90天
fromLongid,查询的起始id,默认从0开始
limitInteger分页页面大小,默认为10,最大为100。
directString枚举:PREV, NEXT;默认是 NEXT

响应参数

参数类型描述
idString分页查询id
symbolString交易对
posSideString持仓方向,当前只有BOTH
sideString枚举:BUYSELL
mgnModeString保证金模式;枚举:ISOLATED 逐仓,CROSS 全仓
posSideString持仓方向, 买卖模式下默认值BOTH,开平仓模式下: LONG:平多 ,SHORT:平空
openAvgPxString开仓均价
closeAvgPxString平仓均价
qtyString持仓张数(成交后的仓位数量)
closedQtyString已平仓数量
availQtyString可平张数
pnlString累计已实现盈亏
feeString平仓手续费
fFeeString累计资金费用
stateString仓位状态;枚举:NORMAL, LIQ, ADL
cTimeString创建时间
uTimeString更新时间

请求示例

{
"from": "0",
"symbol": "BTC_USDT_PERP",
"sTime": "1719880253000",
"eTime": "1719973853000",
"direct": "PREV",
"limit": 100
}

响应示例

{
"code": 200,
"data": [
{
"availQty": "0",
"cTime": "1719910544000",
"closeAvgPx": "0.6271",
"closedQty": "-2",
"fFee": "0.0000025",
"fee": "-0.00012541",
"id": "101000367",
"mgnMode": "CROSS",
"posSide": "BOTH",
"openAvgPx": "0.627",
"pnl": "-0.00002",
"qty": "0",
"side": "SELL",
"state": "NORMAL",
"symbol": "BTC_USDT_PERP",
"uTime": "1719916971000"
},
{
"availQty": "0",
"cTime": "1719919125000",
"closeAvgPx": "0.6272",
"closedQty": "-3",
"fFee": "0.0000345",
"fee": "-0.0001222995",
"id": "101000371",
"mgnMode": "CROSS",
"posSide": "BOTH",
"openAvgPx": "0.6271",
"pnl": "-0.00003",
"qty": "0",
"side": "SELL",
"state": "NORMAL",
"symbol": "BTC_USDT_PERP",
"uTime": "1719973712000"
}
],
"msg": "Success"
}