> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hotstuff.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Margin & Leverage

Hotstuff enables users to trade either in a cross-margin mode or isolated margin mode.

All Positions in cross-margin share the same collateral whereas positions in isolated margin mode have their collateral constrained to their respective position only. Liquidation of an isolated position does not affect a user's other isolated positions or their cross margin positions.

Some perp markets operate in isolated-only mode where only isolated margin is allowed. Further isolated-only markets do not allow users to remove margin from their positions.

### Initial Margin

Initial margin is the margin required to open a position and cannot be withdrawn for cross margin positions. Isolated margin positions support adding and removing margin after the position is opened.

```
IM = position size * mark price / leverage
```

The leverage of position is an integer and can be set by a user to any value between 1 and the max leverage. Max leverage of a perp instrument can vary according to the instrument as well a user's margin tier.

### Maintenance Margin

Maintenance Margin is the total margin required to keep position(s) open.

```
MM = position size * mark price / ( 2* max_leverage)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.