Positions
Request append param
name
type
required
detail
pair
String
√
{
"pair": "ETH-USD",
"method": "SUBSCRIBE",
"apiKey": "?",
"signType": 2,
"signature": "?",
"event": "api_position",
"timestamp": 1657157345159
}
Receive data:
name
type
required
detail
data
Object
position info
event
String
api_position
success
Boolean
true,false
data object:
name
type
required
detail
changeType
String
NEW/ INCREASE/ CLOSE/LIQUIDATE/ REDUCE;
currentQuantity
String
direction
String
LONG/SHORT
operateQuantity
String
positionId
Long
ID
symbol
String
canClosedQuantity
String
contractPairId
Long
positionType
Integer
3 one-way isloate 4 one-way cross
openingPrice
String
marginAmount
String
Initial margin amount
marginCallAmount
String
Example:
1 Get current timestamp(ms):
1725870816532
2 Sign the string format of the timestamp, result:
0xc2a5c5ac88017831c64176d3c0ab0c6275c5c51c7fe496925aa48c7c5c894c431e22d7d94adf7fc0215b8a636bd90f6b0909bc9923f425918740443af2e593b11b
3 Assembling parameters, including basic parameters for subscription and custom additional parameters for the interface.
{
"pair": "ETH-USD",
"method": "SUBSCRIBE",
"event": "api_position",
"apiKey": "st_fq6cvRF4fr5tnKiZfrIntRnLfrwxcXjcfr1y8FR7",
"signature": "0xc2a5c5ac88017831c64176d3c0ab0c6275c5c51c7fe496925aa48c7c5c894c431e22d7d94adf7fc0215b8a636bd90f6b0909bc9923f425918740443af2e593b11b",
"timestamp": 1725870816532,
"signType": "2"
}
4 Returns after a successful subscription
{
"event": "api_position_res",
"method": "SUBSCRIBE",
"msg": "subscribe success: api_position",
"pair": "ETH-USD",
"success": true
}
5 Server websocket push data.
{
"data": {
"canClosedQuantity": "0.06",
"changeType": "NEW",
"contractPairId": 1,
"currentQuantity": "0.06",
"direction": "LONG",
"marginAmount": "39.890168",
"marginCallAmount": "7.5",
"openingPrice": "2300.045",
"operateQuantity": "0",
"positionId": 4796701,
"positionType": 3,
"symbol": "ETH-USD"
},
"event": "api_position",
"success": true
}
Last updated