Initial and Maintenance Margin

Hook Protocol operates on an isolated margin model for each perpetual futures market. This means the margin requirements and potential liquidations are calculated separately for each market position. At this time, there are no cross-margin markets available. Understanding margin and liquidation mechanisms is crucial for effective risk management when trading perpetual futures.

At a high level, the margin system is designed to ensure that every trader has enough surplus equity in their account such that the liquidation system can liquidate their margin account if their position moves against them before the protocol assumes any bad debt.

This is accomplished with two margin limits. First, a higher "Initial Margin" limit, specifying the amount of equity required to open or increase a position. Second, the protocol defines a lower "Maintenance Margin Limit", below which the margin account may be liquidated.

Margin Account Equity

The equity of a margin account is calculated as follows:

Equity = Collateral Balance + Net Position Size * Mark Price

Where:

  • Collateral Balance: The amount of funds deposited in the margin account. After a position is opened, this value can be negative.

  • Net Position Size: The signed magnitude and direction of the assets held by the user.

  • Mark Price: The oracle Mark Price, used to value the positions.

Notional Value

The notional value represents the total value of the positions held in the margin account:

Notional Value = abs(Net Position Size * Mark Price)

Margin Ratio

The margin ratio is the ratio of the equity in the margin account to the notional value of the positions:

Margin Ratio = Equity / Notional Value

Leverage

The leverage of the margin account is the inverse of the margin ratio:

Leverage = Notional Value / Equity

Initial Margin and Maintenance Margin

Each perpetual futures market on Hook Protocol has predefined initial margin and maintenance margin ratios. These ratios are published in Supported Markets.

The initial margin ratio determines the minimum margin required to open a new position, while the maintenance margin ratio is the minimum margin required to keep an existing position open.

For example, if a market has an initial margin ratio of 20% and a maintenance margin ratio of 15%, a trader must have at least 20% of the notional value of the position as collateral to open the position. However, if the margin ratio falls below 15%, the position may be liquidated.

Maximum Leverage

The maximum leverage a trader can employ is the inverse of the initial margin ratio. For instance, with the standard initial margin ratio of 20%, the maximum leverage is 1 / 0.2 = 5x.

Liquidation

If a trader's margin ratio falls below the maintenance margin ratio for a particular market, their position is at risk of liquidation. The liquidator then attempts to market-close all positions in the subaccount using the best prices available in the orderbook. If there is insufficient liquidity for this to occur, the liquidator may take all assets within the subaccount, resulting in a subaccount equity of 0.

If the liquidator is liquidating an insolvent account, the insurance fund, which is funded on every trade, may pay the difference.

If the insurance fund is insufficient, but the overall market is still solvent, the liquidator assumes the position.

If multiple accounts are insolvent, the market and withdrawals from the market are paused, so the liquidator can individually unwind the position. Losses will be socialized among participants in the market. It is an invariant in the protocol that all markets are isolated. So, if socialized loss sharing were to occur within a single market, no other market would be impacted, and other markets could continue to run. This feature prevents contagion across the DEX.

Avoiding Liquidations

It's important to note that if a trader's leverage is below 1x and they have a long position, their position cannot be liquidated, as their equity will always remain positive. However, if the leverage is above 1x and the market moves against the trader's position, the position may be subject to liquidation.

If the trader is short with below 1x leverage, they may still be liquidated if the value of the tracked asset increases to be sufficiently high.

Last updated