查詢持倉 (實時)
該接口可以獲取用戶的持倉信息,比如持倉數量,累計盈虧等
信息
交易帳戶2.0 - 查詢反向合約倉位
- 通過這種查詢方式 "/v3/position/list?category=inverse", 可以獲得所有持倉數據
- 不支持傳入多個symbol來查詢 關於反向合約的額外查詢規則
HTTP 請求
GET /cloud/trade/v3/position/list
請求參數
| 參數 | 是否必需 | 類型 | 說明 |
|---|---|---|---|
| category | true | string | 產品類型
|
| symbol | false | string | 合約名稱
|
| baseCoin | false | string | 交易幣種. |
| settleCoin | false | string | 結算幣種. 對於期貨而言,symbol和settleCon必傳其中一個, 若都傳,則symbol有更高的優先級 |
| limit | false | integer | 每頁數量限制. [1, 200]. 默認: 20 |
| cursor | false | string | 游標,用於翻頁 |
響應參數
| 參數 | 類型 | 說明 |
|---|---|---|
| category | string | 產品類型 |
| list | array | Object |
| > positionIdx | integer | 倉位標識符, 用于在不同仓位模式下标识仓位 |
| > riskId | integer | 风险限额ID,參見風險限額接口. |
| > riskLimitValue | string | 當前風險限額ID對應的持倉限制量. |
| > symbol | string | 合約名称 |
| > side | string | 持倉方向, Buy: 多头; Sell: 空头.
|
| > size | string | 當前倉位的合约數量 |
| > avgPrice | string | 當前倉位的平均入場價格 |
| > positionValue | string | 仓位的價值 |
| > tradeMode | integer | 交易模式。
|
| > positionStatus | String | 倉位状态. Normal,Liq, Adl |
| > leverage | string | 當前倉位的槓桿,仅适用于合约. |
| > markPrice | string | symbol 的最新標記價格 |
| > liqPrice | string | 倉位強平價格。
|
| > bustPrice | string | 倉位破產價格. |
| > positionIM | string | 倉位起始保證金。
|
| > positionMM | string | 倉位維持保證金。
|
| > tpslMode | string | 該字段廢棄, 無意義, 總是返回"Full". |
| > positionBalance | string | 倉位保證金.
|
| > takeProfit | string | 止盈價格 |
| > stopLoss | string | 止損價格 |
| > trailingStop | string | 追蹤止損(與當前價格的距離) |
| > unrealisedPnl | string | 未结盈亏 |
| > cumRealisedPnl | string | 累计已结盈亏 |
| > isReduceOnly | boolean | 僅當Zoomex需要降低某個Symbol的風險限額時有用。
|
| > mmrSysUpdatedTime | string | 僅當Zoomex需要降低某個Symbol的風險限額時有用。
|
| > leverageSysUpdatedTime | string | 僅當Zoomex需要降低某個Symbol的風險限額時有用。
|
| > adlRankIndicator | integer | 自動減倉燈. 什麼是自動減倉機制? |
| > createdTime | string | 倉位創建時間 |
| > updatedTime | string | 倉位數據更新時間 |
| nextPageCursor | string | 游標,用於翻頁 |
請求示例
GET /cloud/trade/v3/position/list?category=linear&symbol=XRPUSDT HTTP/1.1
Host: openapi-testnet.zoomex.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672280218882
X-BAPI-RECV-WINDOW: 5000
響應示例
{
"retCode": 0,
"retMsg": "OK",
"result": {
"nextPageCursor": "updateAt%3D1672279322668",
"category": "linear",
"list": [
{
"symbol": "XRPUSDT",
"leverage": "10",
"avgPrice": "0.3615",
"liqPrice": "0.0001",
"riskLimitValue": "200000",
"takeProfit": "",
"positionValue": "36.15",
"tpslMode": "Full",
"riskId": 41,
"trailingStop": "0",
"unrealisedPnl": "-1.83",
"markPrice": "0.3432",
"cumRealisedPnl": "0.48805876",
"positionMM": "0.381021",
"createdTime": "1672121182216",
"positionIdx": 0,
"positionIM": "3.634521",
"updatedTime": "1672279322668",
"side": "Buy",
"bustPrice": "",
"size": "100",
"positionStatus": "Normal",
"stopLoss": "",
"tradeMode": 0,
"adlRankIndicator": 2
}
]
},
"retExtInfo": {},
"time": 1672280219169
}