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

# Margin & Liquidation

> How margin works for long and short positions, and how liquidation works

Margin requirements depend on whether you are **long** (buying) or **short** (selling) a
contract. This guide explains the model; for the exact formulas see
[Margin & Fees](/latest/options/formulas/margin-and-fees).

## Long Positions (Buying)

When you buy a call or put you pay the **premium** up front, and your risk is capped at
that premium. There is no maintenance margin and no liquidation for a long position — the
amount reserved to open it covers the premium plus a small buffer for fees, insurance, and
slippage.

## Short Positions (Selling)

Selling an option collects the premium but takes on open-ended risk, so it requires an
**initial margin (IM)** to open and a **maintenance margin (MM)** to keep open. Both are
sized from the contract's index and mark prices (with mark-price floors and an
out-of-the-money discount — a reduction for contracts whose strike is far from the current
price) — see
[Margin & Fees](/latest/options/formulas/margin-and-fees) for the precise formulas.

## Liquidation

Positions are monitored continuously against maintenance margin. Liquidation is triggered at
the **account level**: when your maintenance margin reaches **98% of your total equity**
(`maintenanceMarginRatio` above `0.98`), the system reduces or closes at-risk short
positions to bring the account back within limits.

Only accounts holding short positions or open sell orders are margin-monitored. Because a
long position can't lose more than the premium already paid, it is never liquidated and
carries no liquidation price.

## Checking Margin and Account State

* Per-position margin is published as `initialMargin` on the
  [Positions Stream](/latest/options/websocket-api/positions-stream).
* Account-wide collateral, margin in use, and PnL are on the
  [Account Summary Stream](/latest/options/websocket-api/account-summary-stream). Watch
  `maintenanceMarginRatio` to gauge how close the account is to liquidation.
* To size an order, compute the per-unit initial margin and fees from the
  [Margin & Fees](/latest/options/formulas/margin-and-fees) formulas, then divide your
  available balance by that per-unit cost for the maximum quantity you can afford.
