# Account Interface
# 1. Get Perpetual Swap Account Asset Information
Get asset information of user‘s Perpetual Account
HTTP Requests
# Request
POST api/v1/user/getBalance
Request Parameters
Parameters | Type | Required | Field Description | Description |
---|---|---|---|---|
apiKey | String | YES | Interface Key | |
timestamp | String | YES | Timestamp of initiating the request, unit: ms | |
currency | String | YES | Account Asset |
Return Parameters
Parameters | Type | Description |
---|---|---|
code | Int64 | error code, 0 means successfully response, others means response failure |
msg | String | Error Details Description |
userId | String | User's ID |
currency | String | User‘s asset |
balance | Float64 | Asset Balance |
equity | Float64 | Net Asset Value |
unrealisedPNL | Float64 | Unrealized Profit/Loss |
realisedPNL | Float64 | realized Profit/Loss |
availableMargin | Float64 | Available Margin |
usedMargin | Float64 | Used Margin |
freezedMargin | Float64 | Freezed Margin |
longLeverage | Float64 | long Leverage |
shortLeverage | Float64 | short Leverage |
# Response
{
"code": 0,
"msg": "",
"data": {
"userId": "123",
"currency": "USDT",
"balance": 123.33,
"equity": 128.99,
"unrealisedPNL": 1.22,
"realisedPNL": 8.1,
"availableMargin": 123.33,
"usedMargin": 2.2,
"freezedMargin": 3.3,
"longLeverage": 10,
"shortLeverage": 10,
}
}
# 2. Perpetual Swap Positions
Retrieve information on users' positions of Perpetual Swap.
HTTP Requests
# Request
POST api/v1/user/getPositions
Request Method
POST
Request Parameters
Parameters | Type | Required | Field Description |
---|---|---|---|
symbol | String | YES | There must be a hyphen/ "-" in the trading pair symbol. eg: BTC-USDT; Return all if the field is null. |
apiKey | String | YES | |
timestamp | String | YES | Timestamp of initiating the request, unit: ms |
Return Parameters
Parameters | Type | Description |
---|---|---|
code | Int64 | error code, 0 means successfully response, others means response failure |
msg | String | Error Details Description |
symbol | String | Trading pair symbol |
currency | String | Asset Type |
positionId | String | Position ID |
positionSide | String | Direction Long/Short |
marginMode | String | margin mode Cross/Isolated |
volume | Float64 | Volume of opened positions |
availableVolume | Float64 | Volume of positions that can be closed |
unrealisedPNL | Float64 | Unrealized Profit/Loss |
realisedPNL | Float64 | Realized Profit/Loss |
margin | Float64 | Margin |
avgPrice | Float64 | Ave. price |
liquidatedPrice | Float64 | Estimated Liquidation Price |
leverage | Float64 | leverage |
# Response
{
"code": 0,
"msg": "",
"data": {
"positions": [
{
"symbol": "BTC-USDT",
"positionId": "12345678",
"currency": "USDT",
"positionSide": "Long",
"marginMode": "Cross",
"volume": 123.33,
"availableVolume": 128.99,
"unrealisedPNL": 1.22,
"realisedPNL": 8.1,
"margin": 123.33,
"avgPrice": 2.2,
"liquidatedPrice": 2.2,
"leverage": 10,
},
{
"symbol": "ETH-USDT",
"currency": "USDT",
"positionSide": "Short",
"marginMode": "Isolated",
"volume": 123.33,
"availableVolume": 128.99,
"unrealisedPNL": 1.22,
"realisedPNL": 8.1,
"margin": 123.33,
"avgPrice": 2.2,
"liquidatedPrice": 2.2,
"leverage": 10,
},
]
}
}