> ## 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.

# Settlement

The formulas Rails uses to settle contracts at expiry. For a conceptual overview, see the
[Settlement & Expiry](/latest/options/guides/settlement-and-expiry) guide.

## Notation

| Symbol   | Meaning                                                   |
| -------- | --------------------------------------------------------- |
| `S`      | Settlement price of the underlying at expiry              |
| `K`      | Strike price                                              |
| `qty`    | Position quantity — positive for long, negative for short |
| `value`  | Position value (positive for long, negative for short)    |
| `payoff` | Total payoff for the position                             |
| `Index`  | Index price at settlement                                 |

## Payoff

Per-contract payoff, settled against the settlement price `S`:

| Option type | Per-contract payoff |
| ----------- | ------------------- |
| Call (`C`)  | `MAX(S − K, 0)`     |
| Put (`P`)   | `MAX(K − S, 0)`     |

Total payoff scales by the absolute position size:

```
payoff = perContractPayoff × |qty|
```

## Realized PnL

| Side              | Formula          |       |            |
| ----------------- | ---------------- | ----- | ---------- |
| Long (`qty > 0`)  | `payoff − value` |       |            |
| Short (`qty < 0`) | \`               | value | − payoff\` |

## Delivery fee

A delivery fee applies to profitable long positions at settlement, capped at the payoff:

```
deliveryFee = MIN(0.00015 × Index × qty, payoff)
```

Settlement results — including per-position `payoff`, `settlementPrice`, and `realizedPnl` —
are delivered on the [Settlements Stream](/latest/options/websocket-api/settlements-stream).
