API documentation

Portfolio

Everything about the state of your account: what you hold, what is open, how it is margined, and how it has performed. Reads work with a read-tier key; configuration changes (leverage, margin, dust conversion) require trade.

⚠️ Two different defaults. When exchange is omitted, GET /portfolio defaults to binance-spot, while GET /portfolio/positions defaults to binance-futures. Passing exchange explicitly is the robust habit.

Balances — GET /portfolio

const { data } = await lexx.request("GET", "/portfolio",
  { query: { exchange: "binance-spot" } });
{
  "total": { "usd": "12950.50", "btc": "0.19" },
  "balances": [
    { "asset": "USDT", "name": "USDT", "free": "10450.50", "wallet": "12950.50",
      "locked": "2500.00", "lockedByBot": "0", "usd": "12950.50", "total": "12950.50" }
  ]
}
Parameter Effect
full=true Include zero balances (default: non-zero only)
totalOnly=true Return only the aggregated total — the balances array is omitted

Per-asset fields: free (available for trading), locked (held by open orders), lockedByBot (portion reserved by your bots, nullable), wallet/total (full wallet balance — the two are equal), usd (estimated USD value).

If some assets could not be valued, the response carries "partial": true — the total then underestimates your portfolio; treat it as a degraded-data flag.

Open positions — GET /portfolio/positions

For futures/margin accounts (for spot, balances above are your positions).

📌 data is an object, not an array. The key is an opaque string (platform-internal format): don’t parse it — read symbol and side from the position object itself.

{
  "BTCUSDT.BOTH": {
    "symbol": "BTCUSDT", "quote": "USDT", "marketType": "FUTURES",
    "amount": "0.150", "entryPrice": "67250.40", "unrealizedProfit": "385.20",
    "type": "ISOLATED", "leverage": "10", "side": "LONG",
    "isolatedWallet": "1000.00", "liquidationPrice": "61500.00",
    "updateTime": 1743360060000, "bepPrice": "67300.10", "mmr": "0.004"
  }
}
Field Meaning
amount Position size in base asset. One-way mode: positive = long, negative = short. Hedge mode: the direction lives in side
side LONG / SHORT (hedge mode) or BOTH (one-way)
type Margin mode of this position: ISOLATED or CROSSED
entryPrice / bepPrice Average entry / break-even price
unrealizedProfit Unrealized PnL based on mark price
liquidationPrice Estimated liquidation price (null when not applicable)
isolatedWallet Margin allocated to this position (isolated mode)
mmr Maintenance margin rate
updateTime Last update, Unix ms
specific Exchange-specific sub-object with the provider’s raw fields (set varies by exchange)

The position field set varies slightly by exchange: besides the fields above, specific (the provider’s raw sub-object) may appear, and quote is not present on every exchange.

Live position changes stream on the positions WebSocket channel as partial updates — poll REST to bootstrap, then apply deltas.

Leverage

Read current leverage for one or more symbols — symbols is a comma-separated list:

GET /v2/portfolio/position/leverage?exchange=binance-futures&symbols=BTCUSDT,ETHUSDT
[ { "symbol": "BTCUSDT", "side": "BOTH", "leverage": "10", "type": "CROSSED", "cpnl": "125.40" } ]

Set leverage (trade key; 2 / 5 s):

POST /v2/portfolio/position/leverage
{ "exchange": "binance-futures", "symbol": "SOLUSDT", "leverage": 10,
  "marginType": "ISOLATED", "side": "LONG" }

leverage is an integer 1–125; marginType and side (hedge mode) are optional. A successful response has data: null.

Two guards can reject the call:

  • The exchange’s own leverage brackets — the maximum depends on position notional. Check GET /portfolio/leverage-brackets?exchange=…&symbol=…, which returns tiers with initialLeverage, notionalCap/notionalFloor and maintenanceMarginRate.

Margin configuration

Account margin modeGET/POST /portfolio/margin-mode. Values: 1 = single-margin, 2 = multi-asset, 3 = portfolio, 4 = other. 4 is a read-only marker: the backend does not currently reject it on write, but it is not a meaningful target — send only 1–3. On POST, mode may alternatively be passed as a query parameter (the body value takes precedence).

Exchange support: OKX and Bybit (Bybit: portfolio vs regular). Binance accounts do not use this endpoint. See the capability matrix.

Per-position margin typePOST /portfolio/position/margin-type:

{ "symbol": "SOLUSDT", "marginType": "ISOLATED" }

with exchange as a query parameter. ISOLATED = losses capped at the position’s own margin; CROSSED = margin shared across all positions.

Hedge mode

Hedge mode lets you hold a long and a short on the same symbol simultaneously. It lives under the Exchange group:

GET  /v2/exchange/hedge-mode?exchange=binance-futures   → { "dualSidePosition": true }
POST /v2/exchange/hedge-mode?exchange=binance-futures   body: { "dualSidePosition": true }
  • true = hedge mode (dual position side), false = one-way.
  • Futures only — spot exchanges return 400.
  • Once enabled, every futures order must carry positionSide: LONG|SHORT (Orders).

Dust — small-balance conversion

Exchanges accumulate “dust”: residual balances too small to trade. Available on Binance and OKX accounts. Mind the product constraint: converting residuals to BNB on Binance is allowed at most once every 6 hours (exchange rule):

GET /v2/portfolio/dust?exchange=binance-spot

returns the convertible assets (shape follows the exchange). Then convert (trade key):

POST /v2/portfolio/dust/convert
{ "exchange": "binance-spot", "assets": ["SHIB", "HOT", "WIN"], "toAsset": "BNB" }

toAsset defaults to BNB.

Exchange support

Dust, margin mode, hedge mode and leverage brackets are exchange-specific — the authoritative table is in Overview → Supported exchanges. Calling an unsupported feature currently returns 500 INTERNAL_ERROR with a descriptive message.

Verified against API spec v2.0.0 · 2026-07-11

Cookie Preferences

Manage your cookie preferences below. Necessary cookies are always active as they are essential for the website to function properly.

Strictly Necessary

Essential for the website to function. These cookies cannot be disabled.

Analytics

Help us understand how visitors interact with our website by collecting and reporting information anonymously.

Marketing

Used to track visitors across websites to display relevant advertisements.

Preferences

Allow the website to remember choices you make, such as language or region.