Leverage Mechanics: How Margin, Maintenance and Liquidation Fit Together

How initial and maintenance margin fractions set your collateral floor, why the IMF can scale with open interest while the MMF stays fixed, and where liquidation actually begins.

Leverage mechanics, margin, maintenance and liquidation all come down to two percentages that decide how much collateral you must post. Understanding them means knowing exactly which number you must respect to keep a position open and which number you must respect to open it in the first place.

The practical risk is confusing these two thresholds. If you size a position against the looser number, a modest adverse move can push an account toward forced closure before you expect it — so the mechanics deserve a precise read.

Two fractions, two jobs

As part of the 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). They are separate settings with separate purposes.

The Initial Margin Fraction is a percentage (fixed until a certain level of Open Interest) that determines the minimum collateral required to open or increase positions. The Maintenance Margin Fraction is a percentage (fixed) that determines the minimum collateral required to maintain positions and avoid liquidation.

The wording matters. The IMF governs the entry gate and the MMF governs the survival gate. The survival gate is the tighter constraint over the life of the trade, because failing it is what triggers liquidation.

Sizing the requirement for one position

The source lays out the calculation cleanly. The margin requirement for a single position is:

Here S is the size of the position (positive if long, negative if short), P is the price, I is the initial margin fraction, and M is the maintenance margin fraction for the market. The absolute value means the requirement is positive whether the position is long or short — direction does not reduce the collateral owed.

Because both formulas share the same S × P product (notional), the gap between your initial and maintenance requirement is set purely by the gap between I and M. If a market's MMF sits well below its IMF, the buffer between opening a position and hitting the maintenance floor is that much wider.

The account is a sum, not a position

In practice you rarely hold one position in isolation. 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:

That total requirement is then 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 by the account. The Total Account Value is also referred to as equity.

Q is the account's USDC balance, and the source notes that Q may be negative. In the API this is called quoteBalance. Every time a transfer, deposit or withdrawal occurs for an account, the balance changes — so equity is a moving target, not a static figure you can set once.

LayerWhat it does
Initial marginMinimum collateral to open or increase positions
Maintenance marginMinimum collateral to maintain positions and avoid liquidation
Account equityUSDC balance plus value of positions held

Why the IMF can scale but the MMF does not

This is the part that trips people up. The IMF of a perpetual market scales linearly according to the current open_notional in the market, starting at open_notional_lower_cap to open_notional_upper_cap (USDC denominated). At the low end, the effective IMF is the base IMF while open_notional is below the lower cap, and it increases linearly until open_notional reaches the upper cap, at which point the IMF stays at 100% — requiring 1:1 collateral for trading.

The Open Notional Lower Cap and Open Notional Upper Cap are parameters defined as part of the market's Liquidity Tier. So the entry requirement can climb as a market's open interest grows, tying collateral demands to how crowded the book becomes.

Importantly, the MMF does not change. That asymmetry is the whole mechanism: as a market fills up, the entry gate can tighten toward full collateral while the survival gate stays put. A trader who assumed both thresholds rise together would misjudge their risk.

A worked example

This is a Hypothetical illustration, not a reading of any live market. Suppose a market base IMF of 10% and an MMF of 5%. A position with notional of 1,000 would need 100 in initial collateral and 50 in maintenance collateral. The 50 buffer between those figures is the cushion before the maintenance floor is breached.

Now suppose open interest in that Hypothetical market pushes the effective IMF to 20% while the MMF stays at 5%. The same 1,000 notional now needs 200 to open, but the maintenance requirement against that position's notional is still 50. The entry gate doubled; the survival gate did not. Anyone planning to add to a position in a busy market should expect that asymmetry.

The flip side: because the account requirement is a sum across markets, a losing position in one market can erode the equity that supports your maintenance cushion in another. Margin is pooled at the account level.

What the source does not say

The source defines the parameters and the formulas but does not state specific IMF or MMF values for any live market, nor the numeric lower and upper caps for a given Liquidity Tier — those are read from the market you actually trade. It does not describe the liquidation process itself, partial liquidation thresholds, insurance funds, or the order in which positions are closed. It also does not specify the price P used for the comparison against equity, or how funding and fees interact with account value over time. Any specific dollar risk figure depends on inputs the document leaves to the live market.

The safest next step is public verification: before sizing any position, look up the current IMF, MMF, and the open notional caps for that specific market, then compute both margin requirements with the formulas above and compare them against your actual equity — including your USDC balance and position values.

Sources

Informational only. Not financial, legal or investment advice. Check the primary sources listed above before you act on anything here.