Leverage Mechanics: Margin, Maintenance and Liquidation
How initial and maintenance margin fractions set collateral requirements, how account equity is compared against them, and where liquidation risk sits.
The useful answer up front: on a margin-based derivatives venue, two percentages govern your position. The Initial Margin Fraction (IMF) sets the minimum collateral to open or add to a position, and the Maintenance Margin Fraction (MMF) sets the minimum collateral to keep it open and avoid liquidation. The margin requirement for a position is the absolute notional value times the relevant fraction, and the account-level requirement is the sum across all markets where you hold positions.
The two risk parameters
As part of default settings on the dYdX Chain open source software, each market carries two risk parameters: the Initial Margin Fraction (IMF) and the Maintenance Margin Fraction (MMF). The IMF is a percentage, fixed until a certain level of open interest, that determines the minimum collateral required to open or increase positions. The MMF is a percentage, also fixed, that determines the minimum collateral required to maintain positions and avoid liquidation.
Keep the split in mind. The IMF is the gate you pass to enter; the MMF is the floor you must stay above. They answer different questions and can move independently in how they are defined.
How the IMF scales with open interest
The IMF of a perpetual market scales linearly according to the current open_notional in the market, running from open_notional_lower_cap to open_notional_upper_cap, both denominated in USDC. The effective IMF equals the base IMF while open_notional is below the lower cap, then increases linearly until open_notional reaches the upper cap, at which point the IMF stays at 100%, requiring 1:1 collateral for trading.
The important contrast: the MMF does not change. The lower and upper caps are defined as part of the market's Liquidity Tier, so they are market-level parameters rather than your personal settings.
The formulas, position by position
The margin requirement for a single position is calculated as follows:
- Initial Margin Requirement = abs(S × P × I)
- Maintenance Margin Requirement = abs(S × P × M)
S is the size of the position, positive if long and negative if short. M is the maintenance margin fraction for the market. The I term plays the matching role for the initial side: it is the market's effective IMF, consistent with the two-parameter framing above. The absolute value strips out direction, so a short of the same size carries the same requirement as a long.
Summing across markets
The margin requirement for the account as a whole is the sum of the margin requirement over each market i in which the account holds a position:
- Total Initial Margin Requirement = Σ abs(S i × P i × I i)
- Total Maintenance Margin Requirement = Σ abs(S i × P i × M i)
This is where portfolio effects appear. Positions in different markets add to the same total rather than offsetting each other, because each term is taken in absolute value before summing.
What the requirement is compared against
The total margin requirement is compared against the total value of the account, which incorporates the quote asset (USDC) balance of the account as well as the value of the positions held. That total account value is also referred to as equity.
Q is the account's USDC balance, and note that Q may be negative. In the API this field is called quoteBalance. Every time a transfer, deposit or withdrawal occurs for an account, the balance changes, so equity is a moving number rather than a fixed starting figure.
Worked example (Hypothetical)
Assume a market where the effective IMF is 0.10 and the MMF is 0.05, and a position size of 1000 units at a price of 1. All figures here are Hypothetical and chosen for arithmetic clarity, not drawn from live market data.
| Item | Calculation | Result |
|---|---|---|
| Position notional | abs(1000 × 1) | 1000 |
| Initial margin requirement | 1000 × 0.10 | 100 |
| Maintenance margin requirement | 1000 × 0.05 | 50 |
If equity is 200, it sits at twice the stated initial requirement of 100, so the account is comfortably above the entry gate. If equity is 100, it sits at the stated initial requirement and above the maintenance requirement of 50; if equity falls to 50, it sits at the maintenance requirement. Whether equity exactly equal to a threshold is treated as meeting it is not defined in the material quoted here, so treat equality as a boundary to stay clear of rather than a safe resting point.
Now suppose equity drops from 200 to 100 after a price move against the position. The account still holds more than the maintenance requirement of 50, but it no longer clears the initial requirement of 100 for adding risk. The practical reading: you can be safe from liquidation and still unable to open or increase positions.
Why the IMF ramp changes planning
Because the IMF rises linearly with open_notional between the lower and upper caps, the collateral needed to open a given position is not a constant. A market sitting below its lower cap uses the base IMF; growing open interest pushes the effective IMF up, and at the upper cap the requirement reaches 100%, meaning 1:1 collateral for trading.
Meanwhile the MMF stays fixed. That widens the gap between the entry gate and the liquidation floor as a market grows more crowded. For anyone sizing positions, the number to watch before entry is the effective IMF at the current open_notional, not the base figure alone.
Checklist before adding leverage
- Identify the market's effective IMF at current open_notional, not just the base IMF.
- Compute the initial requirement per position using abs(S × P × I).
- Compute the maintenance requirement per position using abs(S × P × M).
- Sum both across every market where you hold a position.
- Compare each total against account equity, including a possibly negative USDC balance.
- Recheck after any transfer, deposit or withdrawal, since the balance changes.
What the source does not say
The material does not specify the exact numerical values of the base IMF, the MMF, or the open notional lower and upper caps for any particular market, nor the Liquidity Tier definitions attached to them. It does not define the precise mechanics of the liquidation process itself, the penalty applied, or how partial versus full liquidation is decided. It does not state whether requirements are compared on a strict or non-strict basis at exact equality.
It also does not describe funding, fees, oracle pricing, or how position value P is sourced. Finally, the parameters described are default settings of open source software, not guarantees about how any deployed market is configured at a given moment. Confirm live parameters before relying on any calculation.
Sources
Informational only. Not financial, legal or investment advice. Check the primary sources listed above before you act on anything here.