Skip to main content

Position Risk

Description

Get the user's current position risk and detailed information.

GET /fapi/v2/positionRisk is also available as an alias for the same handler — some SDKs default to v2; both paths return the identical shape.

HTTP Request

GET /fapi/v1/positionRisk (HMAC SHA256)

Request Parameters

NameTypeRequiredDescription
symbolSTRINGNOTrading pair
timestampLONGYESTimestamp

Response Example

[
{
"symbol": "BTCUSDT",
"positionAmt": "0.001", // Position quantity (negative for SHORT)
"entryPrice": "57183.0", // Average entry price
"breakEvenPrice": "57183.0", // Break-even price
"markPrice": "58123.0", // Current mark price
"unRealizedProfit": "1.12353", // Unrealized PnL
"leverage": "20", // Leverage
"marginType": "cross", // Margin mode
"isolatedMargin": "0.00000000", // Position collateral
"positionSide": "BOTH", // Position side
"notional": "58.123", // Notional position value
"isolatedWallet": "0", // Position collateral
"updateTime": 1623910239123 // Last update time
}
]

If no symbol is sent, all positions will be returned.

For the full constraint set that applies to a position (per-order min/max notional, the maxNotionalValue position cap, OI caps, and the GET …/leverage-brackets endpoint) see Leverage Brackets & Position Limits.

Code Examples

cURL

API_KEY="your_api_key"
API_SECRET="your_api_secret"
TIMESTAMP=$(date +%s%3N)
QUERY_STRING="symbol=BTCUSDT&timestamp=${TIMESTAMP}"
SIGNATURE=$(echo -n "${QUERY_STRING}" | openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')

curl -s -H "X-MBX-APIKEY: ${API_KEY}" \
"https://api.prex.world/fapi/v1/positionRisk?${QUERY_STRING}&signature=${SIGNATURE}"

Python

import time, hmac, hashlib, requests

API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
BASE_URL = "https://api.prex.world"

def sign(params: str) -> str:
return hmac.new(API_SECRET.encode(), params.encode(), hashlib.sha256).hexdigest()

def signed_get(path, params={}):
params["timestamp"] = int(time.time() * 1000)
qs = "&".join(f"{k}={v}" for k, v in params.items())
params["signature"] = sign(qs)
return requests.get(f"{BASE_URL}{path}", params=params, headers={"X-MBX-APIKEY": API_KEY})

# Get position risk information for BTCUSDT
resp = signed_get("/fapi/v1/positionRisk", params={
"symbol": "BTCUSDT"
})
print(resp.json())