Skip to main content

ADL Quantile

Description​

Get the live Binance-aligned ADL (Auto-Deleveraging) quantile indicator (0–4) for the authenticated user's open positions.

Binance-Aligned Live Quantile Calculation

Every open position on a side (LONG or SHORT) is ranked in real time using the Binance USDⓈ-M Futures ADL formula:

  • Profitable (pnl_ratio > 0): adl_score = pnl_ratio × effective_leverage
  • Unprofitable (pnl_ratio < 0): adl_score = pnl_ratio / effective_leverage
  • Tie-breaker: adl_score DESC, created_at ASC, position_id ASC

Positions on each side are divided into 5 equal 20% quintiles:

  • 4: Top 20% (highest ADL risk — first to be deleveraged)
  • 3: 20%–40%
  • 2: 40%–60%
  • 1: 60%–80%
  • 0: Bottom 20% (lowest ADL risk, or no open position on that side)

HTTP Request​

GET /fapi/v1/adlQuantile (HMAC SHA256)

Request Parameters​

NameTypeRequiredDescription
symbolSTRINGNOTrading pair (e.g. BTCUSDT). If omitted, returns quantiles for all symbols with open positions.
timestampLONGYESTimestamp (ms)

Response Example​

Hedge Mode (dualSidePosition: true, default):

[
{
"symbol": "BTCUSDT",
"adlQuantile": {
"LONG": 4,
"SHORT": 0,
"HEDGE": 4
}
}
]

One-way Mode (dualSidePosition: false):

[
{
"symbol": "BTCUSDT",
"adlQuantile": {
"LONG": 4,
"SHORT": 0,
"BOTH": 4
}
}
]

One element is returned per symbol where the account holds an open position. If no symbol is sent, ADL quantiles for all open-position symbols are returned.

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.ztdxtest.xyz/fapi/v1/adlQuantile?${QUERY_STRING}&signature=${SIGNATURE}"

Python​

import time, hmac, hashlib, requests

API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
BASE_URL = "https://api.ztdxtest.xyz"

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 ADL quantile estimation for BTCUSDT
resp = signed_get("/fapi/v1/adlQuantile", params={
"symbol": "BTCUSDT"
})
print(resp.json())