持倉
訂閱持倉數據的推送。當倉位有變動時,即推送消息。
Topic:
user.position.unifiedAccount
響應參數
| 參數 | 類型 | 說明 |
|---|---|---|
| id | string | 消息id |
| topic | string | Topic名 |
| type | string | 消息類型. snapshot |
| ts | number | 消息數據創建時間 |
| data | Object | |
| > version | integer | 版本號 |
| > result | array | Object |
| >> symbol | string | 合約名稱 |
| >> side | string | 持倉方向. Buy,Sell |
| >> size | string | 持倉大小 |
| >> positionIdx | integer | 倉位標識 |
| >> riskId | integer | 風險限額ID. 注意: 組合保證金模式下,該字段返回0,風險限額規則失效 |
| >> leverage | string | 槓桿倍數. 注意: 組合保證金模式下,該字段返回"",槓桿規則失效 |
| >> entryPrice | string | 平均入場價 |
| >> markPrice | string | 標記價 |
| >> positionValue | string | 倉位價值 |
| >> positionIM | string | 倉位初始保證金. 注意: 組合保證金模式下,該字段返回"" |
| >> positionMM | string | 倉位維持保證金. 注意: 組合保證金模式下,該字段返回"" |
| >> tpslMode | string | 止盈止損模式. Full,Partial |
| >> takeProfit | string | 止盈價格 |
| >> stopLoss | string | 止損價格 |
| >> trailingStop | string | 追蹤止損 |
| >> unrealisedPnl | string | 未結盈虧 |
| >> cumRealisedPnl | string | 累計盈虧 |
| >> sessionAvgPrice | string | 結算價格. 期權沒有該字段 |
| >> createdTime | number | 倉位創建時間戳 (毫秒) |
| >> updatedTime | number | 倉位創建時間戳 (毫秒) |
推送示例
{
"id": "3313557309a19343-8362-4dde-9b5a-cef6823173f2",
"topic": "user.position.unifiedAccount",
"ts": 1673242361759,
"data": {
"result": [
{
"positionIdx": 0,
"riskId": 1,
"symbol": "BTCUSDT",
"side": "Sell",
"size": "-0.003",
"entryPrice": "16790",
"leverage": "10.1",
"markPrice": "17225",
"positionIM": "5.02034365",
"positionMM": "0.28506449",
"takeProfit": "",
"stopLoss": "",
"trailingStop": "",
"positionValue": "50.37",
"unrealisedPnl": "-1.305",
"cumRealisedPnl": "-43.69152916",
"createdTime": 1661488246836,
"updatedTime": 1673242361755,
"tpslMode": "Full",
"sessionAvgPrice": "16790"
}
],
"version": 3342620
},
"type": "snapshot"
}