Skip to main content

Position Risk

Description

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

HTTP Request

GET /fapi/v1/positionRisk (HMAC SHA256)

Weight

5

Request Parameters

NameTypeRequiredDescription
symbolSTRINGNOTrading pair
timestampLONGYESTimestamp

Response Example

[
{
"symbol": "BTCUSDT",
"positionAmt": "0.001", // Position quantity
"entryPrice": "57183.0", // Average entry price
"breakEvenPrice": "57183.0", // Break-even price
"markPrice": "58123.0", // Current mark price
"unRealizedProfit": "1.12353", // Unrealized PnL
"liquidationPrice": "0", // Estimated liquidation price
"leverage": "20", // Leverage
"maxNotionalValue": "1000000", // Per-symbol position-notional cap; see ./leverage-brackets.md
"marginType": "cross", // Margin mode (isolated/cross)
"isolatedMargin": "0.00000000", // Isolated margin
"isAutoAddMargin": "false",
"positionSide": "BOTH", // Position side
"notional": "58.123", // Notional position value
"isolatedWallet": "0", // Isolated wallet balance
"updateTime": 1623910239123 // Last update time
}
]

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

The leverage and maxNotionalValue fields above describe the symbol-level limits that apply to this position. For the full constraint set (per-order min/max notional, OI caps, the GET …/leverage-brackets endpoint, and Isolated vs Unified-Margin differences) 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-sepolia.ztdx.io/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.ztdx.io"

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())