💰Margin
The margin engine ensures that users who place trades always have the necessary capital requirements to open and maintain their intended positions.
Initial Margin: The amount required to open a position; calculated as a percentage of notional value based on the asset’s risk profile.
Maintenance Margin: Minimum collateral required to keep a position open; if breached, liquidation is triggered
Initial margin requirements on Perpl are dynamic and may vary by market, depending on volatility and position size.
Margin Mode
The difference between a cross and an isolated margin is:
Isolated Margin: Each position has its own margin
Cross Margin: All collateral in the account is shared across positions
Hybrid Margin: Manually manage margin between positions

Position Equations
Perpetual contracts can be implemented using the following representation of lot sizes, L:
{L : L > 0, L ∈ Z}
Position Notional Value, N:
P = The mark, entry, or realized price, depending on whether or not the value being calculated is unrealized, position, or realized notional value, respectively. L = The position lot size (the number of contracts of the position).
Position Margin Requirement, MR:
N = The position notional value. MF = The margin fraction (analogous to leverage).
Position Initial Margin Requirement, IMR:
N = The position notional value. IMF = Initial margin fraction (maximum leverage allowed to open a position).
Position Maintenance Margin Requirement, MMR:
N = The position notional value. MMF = Maintenance margin fraction (minimum collateralization permitted before a position can be liquidated).
Margining Criteria
The price used to determine the notional value in the invariants presented in this section is the most accurate price available. For example, the best price to use for the notional value of a new position is the price at which the position is entered (realized).
In some situations, for example, auto-deleveraging a position, a realization price is not available, and the failed position’s bankruptcy price is used. In other situations, the mark or synthetic perpetual price may be used to calculate the position's fair market value (for the value of an existing position).
Collateralization for establishing or changing a position:
FMV = Position fair market value. IMR = Position initial margin requirement.
Collateralization for liquidation:
FMV = Position fair market value. MMR = Position Maintenance margin requirement.
Collateralization for Auto Deleverage (ADL):
FMV = Position fair market value.
Last updated