Margin

# Limits

## Initial Margin Fraction [IMF]

The total IMF is the minimum OMF needed to open a new order.

The base IMF is the IMF per market computed as:

- For derivative markets, where
`leverage_max`

is the max allowed initial leverage per market (ex: 20):

$IMF_{base} = \frac{1}{leverage_{max}}$- For borrowing, where W is the weight of the asset being borrowed:

- For derivative markets, where

$IMF_{base} = \frac{1.1}{W} - 1$

- The total IMF is computed as the average of each market's base IMFs weighted by the position open notional for that market

$IMF_{total} = \frac{\sum position \space open \space notional \times IMF_{base}}{total \space position \space open \space notional}$

Warning!

OMF needs to be above the IMF to increase a position.

Warning!

OMF needs to be above the IMF after withdrawal.

## Cancel Margin Fraction [CMF]

The total CMF is the minimum OMF needed to not have your open orders cancelled.

- The base CMF is the CMF per market:
- For derivative markets,

$CMF_{base} = \frac{5 \times IMF_{base}}{8}$

- For borrowing, the CMF base is the same as the borrow IMF base
- The total CMF is computed as the average of each market’s CMF weighted by the position open notional for that market

$CMF_{total} = \frac{\sum position \space open \space notional \times CMF_{base}}{total \space position \space open \space notional}$

## Maintenance Margin Fraction [MMF]

The total MMF is the minimum MF needed to not be liquidated.

- The base MMF is the MMF per market:
- For derivative markets,

$MMF_{base} = \frac{IMF_{base}}{2}$

- For borrowing, where W is the weight of the asset being borrowed:

$MMF_{base} = \frac{1.03}{W} - 1$

- The total MMF is computed as the average of each market’s MMF weighted by the position notional for that market

$MMF_{total} = \frac{\sum position \space notional \times MMF_{base}}{total \space position \space notional}$

Warning!

MF needs to be above the MMF to place new orders.