Sub-accounts
Sub-accounts isolate balances, positions, and margin checks from each other.Account types
A cross-margin account is not global across all of a user’s accounts. Two cross-margin accounts have separate collateral and separate liquidation risk.
Creating Accounts And Transfers
There is no separate “create sub-account” endpoint. Create a trading account by transferring a balance into a newtarget_index with target_account_type set.
POST /account/transfer/sub-account moves a balance between sub-accounts owned by the same user: a trading account transfer between two trading accounts, or a Funding account transfer to or from the Funding account, which turns a token balance into its native asset or back (see Withdrawals). The request is signed and submitted to the OMS, which forwards it to the clearing engine.
Transfers move spot balances only, so a leveraged position cannot leave a sub-account intact. A margin position has two legs:
- Asset (base) balance — the directional exposure. It cannot be transferred while non-zero; close it by trading it to zero through orders.
- Quote (USD) balance — the cash leg. Once the asset balance is zero,
POST /account/transfer/clear-positionfolds the remaining quote into the sub-account’s spot balance, from where it can be transferred, for example to the Funding account to withdraw it. While a long is open, the same call moves only a quote profit to spot and the long stays.
inner, in the field order shown, and any required additional signers.
To transfer into an existing account:
target_index and include the type:
2. For an isolated-margin account, use {"Isolated": {"asset": 2}} as the target type, with the asset index as a number.
Validation rules:
source_indexandtarget_indexmust differ.transfer_amountmust be non-zero and available in the source account, in 18-decimal internal units.- If the target exists, send
target_account_type: null; if it does not exist, send the account type. The field is always in the signed bytes. - A transfer out of a margin account must leave the source passing margin checks. If a configured minimum sub-account balance applies, the remaining balance must be either zero or above that minimum.
- A transfer into a margin account must satisfy account-type rules and any configured minimum balance.
- Isolated-only assets cannot be moved into a cross-margin account. An isolated-margin account accepts only its isolated asset and USD.
0 and 1, with PATCH /account/{user_id}/sub-account/{account_index}/name. A custom name must be nonempty, fit in 32 UTF-8 bytes, cannot contain control characters, and cannot be Spot or Margin.
Margin requirements
Margin is computed in USD per sub-account from per-asset risk parameters published onchain in the Registry and served byGET /registry/risk-parameters. Values in examples are illustrative.
Requirements and surplus
A sub-account is measured against two thresholds.- Maintenance margin (MM) — the threshold for avoiding liquidation, calculated as MM surplus: the distance from liquidation (
distance_from_liquidationinternally,maintenance_margin_surplusin the API). An account becomes liquidatable only when it has borrows, has no circuit-broken collateral, and its MM surplus falls below zero. - Initial margin (IM) — the threshold for opening or increasing a position, calculated as IM surplus. A risk-increasing order is accepted only if it leaves IM surplus >= zero.
Risk parameters
MM and IM replace raw market value with conservative, risk-adjusted value. Three per-asset Registry parameters set the risk adjustment:- Collateral factor (CF) — only
CFof an asset’s value counts as collateral, rounded down. Applies to the asset side of MM. - Liability factor (LF) — borrows count at
(2 - LF)of value, rounded up; e.g. LF = 50% counts a borrow at 1.5x. Applies to the borrow side of MM. - IM factor — for IM, multiply non-USD collateral by
max(0, CF + im_factor − 1), rounding down, and borrows by3 − LF − im_factor, rounding up.im_factoris 1.0 at low exposure and steps down toward a floor as net spot-margin exposure in an asset approaches its spot OI cap, tightening IM as the market crowds.
im_factor is 1.0 at low exposure and steps down to a floor as exposure nears the cap; the breakpoints and floor are per-asset Registry parameters.
Equations
Margin checks
This is when each requirement is evaluated:
IM checks apply only to accounts with open borrows.
Risk-reducing trades skip IM requirements. ie. an account with negative IM surplus can submit a trade that still results in a negative IM surplus as long as IM surplus improved.
Trading capacity and order pressure
Every resting order reserves margin in case it fills. Trading capacity is the IM surplus left after that reservation:GET /margin/user/{user_id} reports it as available_margin. Both pressure terms are defined below.
Order pressure
An order’s margin pressure is the margin it would consume if it filled, including taker fees; order pressure is the margin pressure of all of an account’s open orders. Only the quantity that would increase risk counts:- A buy nets against an existing margin short in the same asset; only buy quantity beyond that short adds pressure.
- A sell nets against an existing margin long in the same asset; only sell quantity beyond that long adds pressure.
- A reduce-only order’s reducing quantity has zero pressure; quantity that would flip or grow exposure is not valid as reduce-only.
5,000 USD order on an asset with CF = 80%, LF = 80%, im_factor = 90%, taker fee 2.5 bps (1.25 USD):
Closeout pressure
When exposure netting is configured for the order’s asset, its Tplus row’s closeout costc adds a third term on both sides:
c the moment it offsets against another leg, so the order is charged for it up front. Open orders earn no offset credit until they fill — an order that would pair against an existing position still pays notional * c, and only the fill itself unlocks the offset. Like the rest of the pressure, the term applies only to the order’s risk-increasing quantity. Example: a 5,000 USD order with c = 20 bps adds 10 USD of pressure.
Aggregating across books
Pressure pools by direction across every book in the sub-account: all buys intobuy_side_pressure, all sells into sell_side_pressure, regardless of asset. Capacity subtracts only the larger total:
max is taken once over the whole sub-account, not per book. Buys and sells move exposure in opposite directions, so only the heavier side is reserved. Offsets stay per-asset — a BTC short never nets against ETH buys — but residual pressures pool across assets within each side.
Example — one cross-margin sub-account, IM surplus 3,000 USD, same risk params as above (buy and sell factors 0.30, fee 2.5 bps of notional), resting orders on three books:
4,000 USD SOL sell and sell-side pressure reaches 2,402 USD. Both sides now have 598 USD of capacity, so trading capacity stays at 598 USD.
Order acceptance
A new order only adds to its own side, so it can only lower that side’s capacity. It is accepted if the resulting capacity stays above a small minimum, else rejected withInsufficientMargin.
- Negative capacity triggers auto-reduce, which cancels or shrinks resting orders farthest-from-market first, per side.
- Designated market makers (DMMs): post-only orders skip this check on a market whose base asset is a native asset, and run it on a token market. Auto-reduce follows the same rule: it never trims those orders for trading capacity, and trims a DMM’s other orders as it does anyone’s.
Account leverage
Leverage reported by the margin API is total notional divided by equity:60,000 USD total notional and 15,000 USD equity reports 4x leverage.
Risk controls
Caps are checked on the proposed post-trade protocol state for every modified non-USD asset. They reject only cap-increasing changes; decreases or unchanged exposure pass.
The checks are:
2,010 ETH, mark is 100 USD, oracle is 99 USD, and the cap is 200,000 USD, the mark-side notional is 201,000 USD, so the trade is rejected. A trade that reduces total OI passes even if the market is already above the cap.
Spot OI cap example: if aggregate ETH credits are 700 ETH and aggregate ETH borrows are 950 ETH, net spot-margin exposure is abs(700 - 950) = 250 ETH. With a 200 ETH cap, a margin trade that opens or grows a position and increases the imbalance is rejected. A trade that brings the imbalance toward zero passes, and so does a margin trade that only reduces a position, even when it trades against a spot order and the imbalance grows. Spot orders are never rejected by this cap, except on a market whose spot OI cap is set to 0 while its total OI cap is positive: there spot buys are rejected (see orders).
Collateral cap example: if margin sub-accounts already hold 9,500 ETH and the ETH collateral cap is 10,000 ETH, adding 600 ETH as margin collateral is rejected because post-trade usage would be 10,100 ETH. Removing collateral passes.
Margin endpoints
See the OMS API for authentication, signing, and request schemas. External accounts can also count as collateral via cross-venue margin.