# Variance carry (variance_carry)

Desk: Options. Page: https://hedgefund.md/models/variance_carry

**What it asks.** What does this variance position pay at this realized vol, and how much faster does a short lose than it earns?

Computes the settlement P and L of a variance position from its strike and vega notional, with realized vol taken from the caller's prices or sent directly. Shows the convexity from half the strike to three times it, and how much faster a short loses than it earns. All numbers come from the caller. Not a quote, a forecast of vol or advice.

Results are hypothetical: arithmetic on the numbers sent, a made-up template or a stated default. Nobody achieved them, and they aren't a forecast, a recommendation, an offer or a record of real trading. Don't show any output to investors or clients, or use it to market an investment. Terms: https://hedgefund.md/terms

## Inputs

| Input | Type | Range | Required | What it is |
| --- | --- | --- | --- | --- |
| `strike_vol_pct` | number | 0.01 to 500 | yes | Variance strike quoted in vol. 20 means 20%. |
| `vega_notional` | number | 0.01 to 10000000000 | yes | Money per vol point at the strike. |
| `side` | string | long \| short | yes | Long receives realized variance. Short pays it. |
| `prices` | array | 2 to 2000 items | no | Price series for realized vol, oldest first. Send this or realized_vol_pct, not both. |
| `realized_vol_pct` | number | 0 to 2000 | no | Realized vol, if not sending prices. 25 means 25%. |
| `periods_per_year` | number | 1 to 100000 | no | Price periods in a year, needed with prices. 252 for trading days, 365 for calendar days. |
| `capital` | number | 0.01 to 10000000000000 | no | Optional. Capital behind the position, for the sleeve and the wipe-out flip. |

## Template

Made-up numbers that run as they stand, so you can see the shape of a result. They aren't market levels, typical values or estimates, and the names in them don't exist. Replace every number before you read anything into a run.

```json
{
  "strike_vol_pct": 20,
  "vega_notional": 10000,
  "side": "short",
  "realized_vol_pct": 26,
  "capital": 1000000
}
```

## What the template gives

On these numbers, a short variance position struck at 20 with realized vol of 26 shows a P and L of -69,000, and -300,000 if realized vol reaches twice the strike.

- Realized vol: 26%
- P and L at settlement: -69,000 (watch)
- P and L at twice the strike: -300,000 (watch)
- The most a short can earn: 100,000
- Loss at twice the strike over gain at zero: 3 times
- Variance notional: 250 per variance point
- Gap to a vol swap: -9,000

Where it flips, with the other inputs held:

- `realized_vol_pct` at 20: P and L is zero at the strike. Above it a long gains and a short loses, and below it the reverse.
- `realized_vol_pct` at 66.33249581: At this realized vol the short has lost the whole capital.

## Formula

Realized vol RV = 100 sqrt(periods/n * sum((ln r)^2)), zero mean, n returns. Long P and L = vega_notional * (RV^2 - K^2) / (2K), RV and K in vol points. Short is the negative.

## Assumptions

- Realized vol assumes a zero mean and divides by n, the number of returns: not n - 1, and not the number of prices.
- Vega notional is money per vol point at the strike, so the variance notional is vega_notional / (2K) per variance point.
- P and L is the settlement figure for the full period, with no discounting. A mark before settlement would also need implied variance for the time left.
- The vol swap line in the table is vega_notional * (RV - K). It shows what convexity adds: the gap is exactly vega_notional * (RV - K)^2 / (2K).
- A short's tail in the sleeve is its loss at twice the strike. A long gains there, so a long's tail is its loss at zero realized vol, the most it can lose.

## Not modeled

- Any cap on realized variance in the contract terms.
- Marks before settlement and changes in implied variance.
- Hedging costs, skew and the strike-replication gap.
- Missed fixings, market closures and dividend adjustments in the return series.
- Margin, financing, fees and counterparty default.
- Taxes.

## Call it

Every result has the same fields: summary, readings, tables, charts, flags, flips, formula, assumptions, not_modeled, hypothetical and inputs_hash. Read flags, flips and not_modeled with the summary, and pass them along together.

### HTTP

No key. The tools keep nothing you send. Send positions by POST, because a URL can land in a server log.

```bash
curl -s https://hedgefund.md/api/v1/variance_carry \
  -H 'content-type: application/json' \
  -d '{"strike_vol_pct":20,"vega_notional":10000,"side":"short","realized_vol_pct":26,"capital":1000000}' \
  | jq '{summary, flags, flips, not_modeled, inputs_hash}'
```

### MCP

The tool is `variance_carry` on the server at https://hedgefund.md/mcp.

```bash
curl -s https://hedgefund.md/mcp \
  -H 'content-type: application/json' -H 'accept: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"variance_carry","arguments":{"strike_vol_pct":20,"vega_notional":10000,"side":"short","realized_vol_pct":26,"capital":1000000}}}' \
  | jq '.result.structuredContent | {summary, flags, flips, not_modeled, inputs_hash}'
```

### The library

The same code on your own machine, with no dependencies, and nothing is sent anywhere.

```bash
curl -fsSL https://hedgefund.md/hedgefund.mjs -o hedgefund.mjs   # read it before you run it
node hedgefund.mjs template variance_carry > mine.json           # replace every number in it
node hedgefund.mjs run variance_carry mine.json | jq '{summary, flags, flips, not_modeled, inputs_hash}'
```

In a script:

```js
import { run, template } from "./hedgefund.mjs";

const inputs = template("variance_carry"); // replace every number in it
const { summary, flags, flips, not_modeled } = run("variance_carry", inputs);
```
