Each trader’s account consists of two balances: a margin balance (denominated in the margin asset, e.g. USDC) and a position balance (denominated in the underlying asset, e.g. BTC). Either balance may be positive or negative. Any trade executed by the trader will increase one balance and decrease the other. All withdrawals and deposits are made in the margin asset and affect only the margin balance. Positions (e.g. BTC) cannot be withdrawn directly.
Note that there is no isolated margin mode for perpetuals, as each account has only a single position based on the balances.
The “riskiness” of an account is measured via the margin percentage, defined as follows:
Margin Percentage = Collateralization Ratio - 1
Where the collateralization ratio of an account is defined as:
Collateralization Ratio = Value of Positive Balances / Absolute Value of Negative Balances
The relative value between currencies is determined by the on-chain index price. For example, in the BTC/USDC perpetual, margin percentage is a function of the BTC/USD index and the account’s BTC and USDC balances.
An account whose margin percentage falls below the maintenance margin requirement may be liquidated. Accounts are restricted from making trades or withdrawals that would bring their account below the initial margin requirement, which is set higher than the maintenance margin requirement. Movements in the index price may, however, cause an account to drop below the initial margin requirement and, eventually, the maintenance margin requirement.
Accounts which fall below the initial margin requirement are restricted from making withdrawals and certain trades until the account’s margin percentage is brought back to the initial margin requirement. These “risky” accounts are barred from making trades that do any of the following:
Decrease the account’s margin percentage.
Increase the absolute size of the account position.
Change the sign of the account position (long to short, or vice versa).
These restrictions apply whether the “risky” account is a taker or a maker in the trade.