HEDGEFUND.md

Models / Options / options_book

Options book

What are this option book's Greeks, where does it break even, and which shock hurts it most?

Prices a book of European options by Black-Scholes-Merton and gives value, delta, gamma, vega, theta and rho per leg and for the book, a full-reprice P and L grid across spot and vol shocks, the worst node against capital, and exact expiry break-evens. Every price, vol and rate comes from the caller. Not a quote, a margin figure or advice.

The paste-ready promptmodel.md

On these numbers, the book is worth -1,916.83 at the vols sent, with delta -92.27 units, and its worst grid node (spot +30%, vol +20 points) loses 21,592.5, or 43.18% of capital. Expiry break-evens at 88.08 and 111.92.

Hypothetical, and on made-up numbers until you replace them. Nobody traded this, and nothing here is on offer.

Readings

The numbers, with their units.

Book value

-1,916.83

Negative: the book is net short premium.

Delta

-92.27units of underlying

About -9,227.06 of underlying at this spot.

Gamma

-40.23units per 1 of spot

Vega

-207.42per vol point

Theta

23.4per calendar day

Rho

-18.28per 1% of rate

Worst grid node

-21,592.5

Spot +30%, vol +20 points.

Worst node, share of capital

breach

43.18%

Against a 25% loss line.

What flips it

The value of one input where the outcome changes, with the others held.

  1. spot_at_expiry

    88.08

    Expiry P and L is a loss below this spot and a gain above it.

  2. spot_at_expiry

    111.92

    Expiry P and L is a gain below this spot and a loss above it.

  3. spot_shock_pct

    22.95

    A spot rise of this size, at the vols sent, reaches an instant loss of 25% of capital, the loss line in use.

  4. vol_shock_pts

    54.37

    A vol rise of this many points on every leg, at today's spot, reaches an instant loss of 25% of capital, the loss line in use.

  5. spot

    97.61now 100

    The book's delta changes sign at this spot, at the vols sent.

Flags

What went past a line, and what to read before you trust the rest.

  • watch
    Above the top strike, expiry P and L falls by 1,000 for each 1 of spot, with no cap. The worst grid node stops where the grid stops. loss_grows_on_rise
  • breach
    The worst node loses 43.18% of capital, past the 25% loss line. loss_past_limit
  • watch
    The worst node sits on the edge of the grid. A wider shock could lose more, and the grid can't say how much. worst_on_grid_edge

What this leaves out

What the formula leaves out, by name.

  • Early exercise of American options.
  • Skew and term-structure moves: every leg's vol shifts by the same points.
  • Discrete dividends and jumps. The spot is lognormal between shocks.
  • Delta hedging and its costs. The grid is a one-time shock, not a path.
  • Bid-ask spreads, commissions, slippage, margin and financing of the premium.
  • Assignment, pin risk and settlement details at expiry.
  • Taxes.
What it took as given (8)

What it took as given to get here.

  • European exercise. One flat vol per leg, with a continuous rate and a continuous dividend yield.
  • Delta is per unit of underlying, times qty and multiplier. Gamma is the change in that delta per 1 of spot. Vega is per one vol point. Theta is per calendar day: annual theta over 365. Rho is per one percent of rate.
  • Grid shocks are instant. No time passes, the rate and yield stay put, and every leg's vol moves by the same points, floored at zero.
  • Zero time is intrinsic on the spot, with no time left to earn or lose, so vega, theta and rho are zero.
  • Zero vol with time left is intrinsic on the discounted forward: a call is max(S e^-qT - K e^-rT, 0), a put the mirror. Gamma is reported as zero there.
  • A leg with zero vol exactly at its forward, or zero time exactly at its strike, takes N(d1) = one half, the limit of the formula.
  • Values come from the vols sent, not from trade prices. Expiry P and L is the payoff minus today's model value, with no interest on that value.
  • The sleeve's gross and net are delta times spot over capital, summed by leg. Its tail is the worst grid node.
P and L at expiry, and now at the vols sentP and L
  • At expiry
  • Now
-60K-40K-20K0406080100120140160Spot-55,958.42
The data

Legs and book

legtypeqtystrikeexpiry_yearsvol_pctunit_valuevaluedeltagammavega_per_pointtheta_per_dayrho_per_pct
Leg 1put-10900.25261.3027-1,302.72174.93-19.81-128.7416.7646.99
Leg 2put10800.25320.474509474.51-63.97.816362.53-10.39-17.16
Leg 3call-101100.25201.0886-1,088.62-203.3-28.24-141.2217.03-48.1
Book-1,916.83-92.27-40.23-207.4223.4-18.28

P and L by shock (rows: spot shock in percent, columns: vol shock in points)

spot_shock_pctvol -5vol 0vol +5vol +10vol +20
-30-7,065.65-6,645.41-6,262.23-5,936.99-5,504.28
-20-4,069.53-3,820.72-3,673.95-3,632.5-3,886.08
-10-429.64-823.51-1,294.52-1,864.33-3,251.27
-5659.81-11.23-811.68-1,700.58-3,627.4
0953.080-1,086.49-2,231.48-4,573.77
5197.55-984.95-2,245.76-3,535.93-6,118.44
10-1,839-3,047.68-4,315.7-5,617.87-8,250.65
20-9,305.81-9,961.47-10,822.88-11,826.71-14,093.41
30-18,883.25-19,050.54-19,421.58-19,990.68-21,592.5

Expiry P and L at each kink and break-even

spot_at_expirypayoffpnl_at_expirypoint
0-10,000-8,083.17zero spot
80-10,000-8,083.17strike
88.08-1,916.830break-even
9001,916.83strike
11001,916.83strike
111.92-1,916.830break-even

Hypothetical, computed from the numbers sent and any stated default, with hindsight. Nobody traded it, and costs and liquidity are only as assumed. Not a forecast, a recommendation, an offer, or a record of real trading. Don't use it to market an investment.

formula d1 = (ln(S/K) + (r - q + v^2/2) T) / (v sqrt(T)), d2 = d1 - v sqrt(T). Call = S e^(-qT) N(d1) - K e^(-rT) N(d2). Put = K e^(-rT) N(-d2) - S e^(-qT) N(-d1). Greeks are the closed-form partials, times qty and multiplier. A grid node's P and L is the full reprice at the shocked spot and vol, minus today's value.

inputs_hash 6739132467662f61

Paste it into your agent

No connection needed. This prompt carries the method, the conventions and what this site's engine gives on the made-up numbers, so your agent can check its own work before it touches real ones. Every prompt, with its hash, is listed at /prompts.json. A copy that stays fixed for this version, for a stack to point at: /v/1.0/models/options_book.md.

prompt.md
# Options book: a prompt from hedgefund.mdPaste this into your AI agent. It needs no connection to hedgefund.md. An agent that can run code should write and run it, and shouldn't work a long series by hand.**Question.** What are this option book's Greeks, where does it break even, and which shock hurts it most?## Methodd1 = (ln(S/K) + (r - q + v^2/2) T) / (v sqrt(T)), d2 = d1 - v sqrt(T). Call = S e^(-qT) N(d1) - K e^(-rT) N(d2). Put = K e^(-rT) N(-d2) - S e^(-qT) N(-d1). Greeks are the closed-form partials, times qty and multiplier. A grid node's P and L is the full reprice at the shocked spot and vol, minus today's value.## Conventions- European exercise. One flat vol per leg, with a continuous rate and a continuous dividend yield.- Delta is per unit of underlying, times qty and multiplier. Gamma is the change in that delta per 1 of spot. Vega is per one vol point. Theta is per calendar day: annual theta over 365. Rho is per one percent of rate.- Grid shocks are instant. No time passes, the rate and yield stay put, and every leg's vol moves by the same points, floored at zero.- Zero time is intrinsic on the spot, with no time left to earn or lose, so vega, theta and rho are zero.- Zero vol with time left is intrinsic on the discounted forward: a call is max(S e^-qT - K e^-rT, 0), a put the mirror. Gamma is reported as zero there.- A leg with zero vol exactly at its forward, or zero time exactly at its strike, takes N(d1) = one half, the limit of the formula.- Values come from the vols sent, not from trade prices. Expiry P and L is the payoff minus today's model value, with no interest on that value.- The sleeve's gross and net are delta times spot over capital, summed by leg. Its tail is the worst grid node.## Step 1: check your method on these made-up numbersThe numbers and names below are made up. They aren't market levels, typical values or anyone's real figures.```json{  "spot": 100,  "rate_pct": 4,  "dividend_yield_pct": 1,  "capital": 50000,  "loss_limit_pct": 25,  "legs": [    {      "type": "put",      "qty": -10,      "strike": 90,      "expiry_years": 0.25,      "vol_pct": 26,      "multiplier": 100    },    {      "type": "put",      "qty": 10,      "strike": 80,      "expiry_years": 0.25,      "vol_pct": 32,      "multiplier": 100    },    {      "type": "call",      "qty": -10,      "strike": 110,      "expiry_years": 0.25,      "vol_pct": 20,      "multiplier": 100    }  ],  "spot_shocks_pct": [-30, -20, -10, -5, 0, 5, 10, 20, 30],  "vol_shocks_pts": [-5, 0, 5, 10, 20]}```Work them out with the method above. Yours should match these within 0.5%.- Book value: -1916.83026- Delta: -92.2706368 units of underlying- Gamma: -40.23277629 units per 1 of spot- Vega: -207.4236627 per vol point- Theta: 23.40056579 per calendar day- Rho: -18.27558355 per 1% of rate- Worst grid node: -21592.4974- Worst node, share of capital: 43.1849948 %Where the outcome flips, with the other inputs held:- spot_at_expiry at 88.08316974: Expiry P and L is a loss below this spot and a gain above it.- spot_at_expiry at 111.9168303: Expiry P and L is a gain below this spot and a loss above it.- spot_shock_pct at 22.94921041: A spot rise of this size, at the vols sent, reaches an instant loss of 25% of capital, the loss line in use.- vol_shock_pts at 54.37068462: A vol rise of this many points on every leg, at today's spot, reaches an instant loss of 25% of capital, the loss line in use.- spot at 97.60749653: The book's delta changes sign at this spot, at the vols sent.If yours differ, stop and tell the person which ones and by how much. Don't go on to real numbers until they match, or until the person has seen the difference. These values come from one engine and can be wrong too.## Step 2: run it on the person's numbersReplace every input with the person's own. Ask for any number you don't have, and don't invent one.## Step 3: reportGive one sentence beginning "On these numbers,", then the values, then where the outcome flips. Always add what this leaves out:- Early exercise of American options.- Skew and term-structure moves: every leg's vol shifts by the same points.- Discrete dividends and jumps. The spot is lognormal between shocks.- Delta hedging and its costs. The grid is a one-time shock, not a path.- Bid-ask spreads, commissions, slippage, margin and financing of the premium.- Assignment, pin risk and settlement details at expiry.- Taxes.## LimitsResults are hypothetical: arithmetic on the numbers given, prepared with hindsight. Nobody achieved them, and costs and liquidity are only as assumed. They aren't a forecast, a recommendation, an offer or a record of real trading. Don't say what to buy, sell or hold, and don't use them to market an investment. Whether a person may hold or trade an instrument is a legal question for counsel.Provided as is, at your own risk, by hedgefund.md, which is not a fund and isn't anyone's adviser. Version 1.0. Source: https://hedgefund.md/models/options_book/prompt.md. Terms: https://hedgefund.md/terms

Call it

The same code answers on this page, over HTTP, over MCP and on your own machine, and the same inputs give the same bytes. No key, and nothing is stored. Send positions by POST or run the library, because a URL can land in a server log. model.md holds all of this for your agent.

POST the inputs to /api/v1/options_book.

terminal
curl -s https://hedgefund.md/api/v1/options_book \  -H 'content-type: application/json' \  -d '{"spot":100,"rate_pct":4,"dividend_yield_pct":1,"capital":50000,"loss_limit_pct":25,"legs":[{"type":"put","qty":-10,"strike":90,"expiry_years":0.25,"vol_pct":26,"multiplier":100},{"type":"put","qty":10,"strike":80,"expiry_years":0.25,"vol_pct":32,"multiplier":100},{"type":"call","qty":-10,"strike":110,"expiry_years":0.25,"vol_pct":20,"multiplier":100}],"spot_shocks_pct":[-30,-20,-10,-5,0,5,10,20,30],"vol_shocks_pts":[-5,0,5,10,20]}' \  | jq '{summary, flags, flips, not_modeled, inputs_hash}'

Inputs

InputTypeRangeRequiredWhat it is
spotnumber0.000001 to 1000000000yesSpot price of the underlying.
rate_pctnumber-10 to 50yesContinuously compounded interest rate. 4 means 4%.
dividend_yield_pctnumber-10 to 50yesContinuous dividend yield on the underlying. 1 means 1%.
capitalnumber0.01 to 10000000000000yesCapital the worst loss is measured against.
legsarray1 to 30 itemsyesThe options in the book. Up to 30.
legs[].typestringcall | putyesCall or put.
legs[].qtynumber-10000000 to 10000000yesContracts, signed. Negative is short.
legs[].strikenumber0.000001 to 1000000000yesStrike price.
legs[].expiry_yearsnumber0 to 30yesYears to expiry. 0 means expiring now.
legs[].vol_pctnumber0 to 500yesThis leg's volatility. 20 means 20%.
legs[].multipliernumber0.000001 to 1000000noUnits of underlying per contract. Default 100.
spot_shocks_pctarray0 to 15 itemsnoInstant spot moves for the grid. -10 means down 10%. Left out or empty uses -30 to +30.
vol_shocks_ptsarray0 to 15 itemsnoVol shifts for the grid, in vol points on every leg. Left out or empty uses -5 to +20.
loss_limit_pctnumber0.01 to 1000noThe caller's own loss line, as a share of capital, for flags and flips. Default 25.

Hypothetical, and on made-up numbers until you replace them. Nobody traded this, and nothing here is on offer.

1.0Use at your own risk: hedgefund.md is not a fund, not an offer of any security, token or fund interest, and not advice. Results are hypothetical, may be wrong, and are not a record of real trading. Don't use them to market an investment. See the terms.