Skip to main content

Unified Account Snapshot

Return a live-computed snapshot of the caller's unified-margin account: equity, initial / maintenance margin, uniMMR, status.

The response reflects the same values the background risk worker uses to drive status transitions; they are recomputed on every request (wallet balance + open positions + latest mark prices).

HTTP Request

GET /api/v1/unified/account (HMAC SHA256)

Request Parameters

NameTypeRequiredDescription
timestampLONGYESTimestamp

Response Example

{
"margin_mode": "unified",
"wallet_balance": "12345.678901234567890000",
"total_equity": "12450.123456789012345678",
"available_balance": "10450.123456789012345678",
"total_initial_margin": "2000.000000000000000000",
"total_maintenance_margin": "120.500000000000000000",
"total_unrealized_pnl": "104.444555554444555554",
"uni_mmr": "103.320525782584122371",
"account_status": "normal"
}

Field semantics

FieldMeaning
margin_modeCurrent mode of the caller (isolated or unified)
wallet_balancebalances.available + balances.frozen of the collateral token
total_equitywallet_balance + Σ unrealized_pnl − Σ accumulated_fees
available_balancetotal_equity − total_initial_margin (new-order budget)
total_initial_marginΣ (notional / leverage) across open positions
total_maintenance_marginTier-aware Σ MM_per_position
total_unrealized_pnlSum of per-position unrealized PnL at current mark
uni_mmrtotal_equity / total_maintenance_margin; null when no open positions
account_statusOne of normal, warning_1, warning_2, reduce_only, liquidating

Behavior in Isolated Mode

Calling this endpoint while margin_mode == "isolated" still returns a valid snapshot: the numbers reflect what the account would look like if it were unified. This is handy for UIs that want to preview the effect of switching.

Code Examples

curl

API_KEY="your_api_key"
API_SECRET="your_api_secret"
TIMESTAMP=$(date +%s%3N)
QUERY="timestamp=${TIMESTAMP}"
SIGNATURE=$(echo -n "${QUERY}" | openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')
curl -s -H "X-MBX-APIKEY: ${API_KEY}" \
"https://api.ztdx.io/api/v1/unified/account?${QUERY}&signature=${SIGNATURE}"

Python

import time, hmac, hashlib, requests

API_KEY = "your_api_key"
API_SECRET = "your_api_secret"

ts = int(time.time() * 1000)
q = f"timestamp={ts}"
sig = hmac.new(API_SECRET.encode(), q.encode(), hashlib.sha256).hexdigest()
r = requests.get(
f"https://api.ztdx.io/api/v1/unified/account?{q}&signature={sig}",
headers={"X-MBX-APIKEY": API_KEY},
)
snap = r.json()
print(f"uniMMR={snap['uni_mmr']} status={snap['account_status']}")