Skip to main content
aifinhub

Worked example

Running the shipped options-payoff-builder engine on the input below produces exactly this output. Continuous integration recomputes it against the engine bundle on every build, so these numbers cannot drift from the code.

Input

{
  "tool": "options-payoff-builder",
  "side": "",
  "type": "",
  "strike": 0,
  "contracts": 0,
  "spot": 100,
  "annual_vol": 0.25,
  "days_to_expiry": 30,
  "risk_free_rate": 0.045,
  "dividend_yield": 0,
  "grid_points": 121,
  "spot_range_pct": 0.4,
  "legs": [
    {
      "side": "long",
      "type": "call",
      "strike": 105,
      "contracts": 1
    },
    {
      "side": "short",
      "type": "call",
      "strike": 115,
      "contracts": 1
    }
  ]
}

Output

{
  "netPremium": 1.0934222772446986,
  "greeks": {
    "delta": 0.24523003518729625,
    "gamma": 0.036855884157245784,
    "thetaPerDay": -0.03444327384933186,
    "vegaPer1Pct": 0.07573126881625845,
    "rhoPer1Pct": 0.01925719006149446
  },
  "grid": [
    {
      "spot": 60,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 60.666666666666664,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 61.333333333333336,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 62,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 62.666666666666664,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 63.333333333333336,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 64,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 64.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 65.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 66,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 66.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 67.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 68,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 68.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 69.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 70,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 70.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 71.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 72,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 72.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 73.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 74,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 74.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 75.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 76,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 76.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 77.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 78,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 78.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 79.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 80,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 80.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 81.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 82,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 82.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 83.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 84,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 84.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 85.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 86,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 86.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 87.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 88,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 88.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 89.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 90,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 90.66666666666667,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 91.33333333333333,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 92,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 92.66666666666666,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 93.33333333333334,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 94,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 94.66666666666666,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 95.33333333333334,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 96,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 96.66666666666666,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 97.33333333333334,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 98,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 98.66666666666666,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 99.33333333333334,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 100,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 100.66666666666666,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 101.33333333333334,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 102,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 102.66666666666666,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 103.33333333333334,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 104,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 104.66666666666666,
      "payoff": -1.0934222772446986
    },
    {
      "spot": 105.33333333333334,
      "payoff": -0.7600889439113558
    },
    {
      "spot": 106,
      "payoff": -0.09342227724469865
    },
    {
      "spot": 106.66666666666666,
      "payoff": 0.5732443894219585
    },
    {
      "spot": 107.33333333333334,
      "payoff": 1.2399110560886442
    },
    {
      "spot": 108,
      "payoff": 1.9065777227553014
    },
    {
      "spot": 108.66666666666666,
      "payoff": 2.5732443894219585
    },
    {
      "spot": 109.33333333333334,
      "payoff": 3.239911056088644
    },
    {
      "spot": 110,
      "payoff": 3.9065777227553014
    },
    {
      "spot": 110.66666666666666,
      "payoff": 4.5732443894219585
    },
    {
      "spot": 111.33333333333334,
      "payoff": 5.239911056088644
    },
    {
      "spot": 112,
      "payoff": 5.906577722755301
    },
    {
      "spot": 112.66666666666666,
      "payoff": 6.5732443894219585
    },
    {
      "spot": 113.33333333333334,
      "payoff": 7.239911056088644
    },
    {
      "spot": 114,
      "payoff": 7.906577722755301
    },
    {
      "spot": 114.66666666666666,
      "payoff": 8.573244389421959
    },
    {
      "spot": 115.33333333333334,
      "payoff": 8.906577722755301
    },
    {
      "spot": 116,
      "payoff": 8.906577722755301
    },
    {
      "spot": 116.66666666666666,
      "payoff": 8.906577722755301
    },
    {
      "spot": 117.33333333333334,
      "payoff": 8.906577722755301
    },
    {
      "spot": 118,
      "payoff": 8.906577722755301
    },
    {
      "spot": 118.66666666666666,
      "payoff": 8.906577722755301
    },
    {
      "spot": 119.33333333333334,
      "payoff": 8.906577722755301
    },
    {
      "spot": 120,
      "payoff": 8.906577722755301
    },
    {
      "spot": 120.66666666666666,
      "payoff": 8.906577722755301
    },
    {
      "spot": 121.33333333333334,
      "payoff": 8.906577722755301
    },
    {
      "spot": 122,
      "payoff": 8.906577722755301
    },
    {
      "spot": 122.66666666666666,
      "payoff": 8.906577722755301
    },
    {
      "spot": 123.33333333333334,
      "payoff": 8.906577722755301
    },
    {
      "spot": 124,
      "payoff": 8.906577722755301
    },
    {
      "spot": 124.66666666666667,
      "payoff": 8.906577722755301
    },
    {
      "spot": 125.33333333333333,
      "payoff": 8.906577722755301
    },
    {
      "spot": 126,
      "payoff": 8.906577722755301
    },
    {
      "spot": 126.66666666666667,
      "payoff": 8.906577722755301
    },
    {
      "spot": 127.33333333333333,
      "payoff": 8.906577722755301
    },
    {
      "spot": 128,
      "payoff": 8.906577722755301
    },
    {
      "spot": 128.66666666666669,
      "payoff": 8.906577722755301
    },
    {
      "spot": 129.33333333333331,
      "payoff": 8.906577722755301
    },
    {
      "spot": 130,
      "payoff": 8.906577722755301
    },
    {
      "spot": 130.66666666666669,
      "payoff": 8.906577722755301
    },
    {
      "spot": 131.33333333333331,
      "payoff": 8.906577722755301
    },
    {
      "spot": 132,
      "payoff": 8.906577722755301
    },
    {
      "spot": 132.66666666666669,
      "payoff": 8.906577722755301
    },
    {
      "spot": 133.33333333333331,
      "payoff": 8.906577722755301
    },
    {
      "spot": 134,
      "payoff": 8.906577722755301
    },
    {
      "spot": 134.66666666666669,
      "payoff": 8.906577722755301
    },
    {
      "spot": 135.33333333333331,
      "payoff": 8.906577722755301
    },
    {
      "spot": 136,
      "payoff": 8.906577722755301
    },
    {
      "spot": 136.66666666666669,
      "payoff": 8.906577722755301
    },
    {
      "spot": 137.33333333333331,
      "payoff": 8.906577722755301
    },
    {
      "spot": 138,
      "payoff": 8.906577722755301
    },
    {
      "spot": 138.66666666666669,
      "payoff": 8.906577722755301
    },
    {
      "spot": 139.33333333333331,
      "payoff": 8.906577722755301
    },
    {
      "spot": 140,
      "payoff": 8.906577722755301
    }
  ],
  "maxProfit": 8.906577722755301,
  "maxLoss": -1.0934222772446986,
  "breakEvens": [
    106.0934222772447
  ]
}

Frequently asked questions

What does the Options Payoff Builder methodology page document?
Multi-leg Black-Scholes pricing, Greek aggregation, piecewise-linear payoff derivation, assumptions, and limitations for the Options Payoff Builder. It states the formulas, assumptions, data sources, limitations, and reproducibility steps behind the Options Payoff Builder, in the Finance category.
When was the Options Payoff Builder methodology last reviewed?
This methodology was last reviewed on 2026-04-20. The matching tool is at https://aifinhub.io/options-payoff-builder/.
Are the Options Payoff Builder numbers reproducible?
Yes. This page embeds a worked example whose output is the verbatim result of running the shipped options-payoff-builder engine on a fixed input; the embedded JSON is recomputed and diffed against the engine in CI, so the numbers cannot drift from the code.

Methodology · Playground · Last updated 2026-04-20

How Options Payoff Builder works

How the Options Payoff Builder tool actually works — pricing, aggregation, payoff computation, limitations.

Scope

Computes the at-expiry payoff diagram and current-spot Greeks for a user-constructed 1–4 leg option strategy. Each leg is a long or short call or put at a specified strike, sized by integer contract count. Pricing uses generalised Black-Scholes with continuous dividend yield.

Per-leg pricing

d1 = [ln(S/K) + (r − q + σ²/2)·T] / (σ·√T)
d2 = d1 − σ·√T
call = S·e^(−qT)·Φ(d1) − K·e^(−rT)·Φ(d2)
put  = K·e^(−rT)·Φ(−d2) − S·e^(−qT)·Φ(−d1)

S is spot, K strike, σ annualised volatility, T years to expiry (minimum 0.5/365 to avoid singularities), r risk-free rate, q continuous dividend yield. Φ uses the Abramowitz & Stegun 26.2.17 rational approximation.

Per-leg Greeks

  • Delta: call e^(−qT)·Φ(d1), put −e^(−qT)·Φ(−d1).
  • Gamma: e^(−qT)·φ(d1) / (S·σ·√T), same for call + put.
  • Vega (per 1% vol): S·e^(−qT)·φ(d1)·√T / 100.
  • Theta (per day): annualised BS theta divided by 365.
  • Rho (per 1% rate): call K·T·e^(−rT)·Φ(d2) / 100, put negative.

Multi-leg aggregation

For each leg i with side s_i ∈ {+1, −1} (long / short) and contract count n_i:

Greek_total = Σ_i  s_i · n_i · Greek_i
net_premium = Σ_i  s_i · n_i · price_i
payoff_at_expiry(S) =
    Σ_i  s_i · n_i · max(0, (type_i == call ? S − K_i : K_i − S))
net_profit_at_expiry(S) = payoff_at_expiry(S) − net_premium

Break-even points are zero crossings of net_profit_at_expiry(S), found by linear interpolation across a 200-point grid centred on spot (±50% by default).

Presets

The strategy presets seed a starting point; you can edit any leg afterwards. Strikes scale from spot:

  • Long call: 1 long call @ spot.
  • Long straddle: long call + long put @ spot.
  • Long strangle: long 1.05× OTM call + long 0.95× OTM put.
  • Bull call spread: long spot call + short 1.05× call.
  • Bear put spread: long spot put + short 0.95× put.
  • Iron condor: short 1.05× call + long 1.10× call + short 0.95× put + long 0.90× put.
  • Long call butterfly: long 0.95× call + 2 short spot calls + long 1.05× call.

Assumptions + limitations

  1. European exercise. Black-Scholes assumes no early exercise. For American equity options this is an approximation; for index options (SPX, RUT) it is exact in structure.
  2. Continuous dividend yield. Discrete dividends are not modelled; for single names with large cash dividends, use a dividend-adjusted model.
  3. Constant volatility + rate. No term structure, no skew/smile. For multi-leg strategies that depend on skew (risk reversals), this can materially under-price the structure. Use a local-vol or SABR model for production.
  4. Log-normal underlying. Fat-tailed equity returns cause Black-Scholes to under-price OTM options. For deep OTM legs in your structure, treat the price as an optimistic lower bound.
  5. No transaction costs, no bid-ask. Net premium is theoretical. Live bid-ask can cost 2–20% of theoretical on low-liquidity strikes, especially for multi-leg combos.
  6. Greeks at current spot only. The aggregated Greeks are instantaneous sensitivities at S = spot now. As spot moves, all Greeks except the second-order approximation change.
  7. Integer contracts. Fractional-contract strategies are not supported.

Privacy

All pricing, payoff computation, and aggregation run in the browser. No inputs leave the page.

References

  • Black, F., & Scholes, M. (1973). "The Pricing of Options and Corporate Liabilities." Journal of Political Economy 81(3).
  • Merton, R. C. (1973). "Theory of Rational Option Pricing." Bell Journal of Economics 4(1).
  • Hull, J. C. (2017). Options, Futures, and Other Derivatives, 10th ed., §15.
  • McMillan, L. G. (2012). Options as a Strategic Investment, 5th ed. — classic reference for multi-leg strategies.

Connects to

External resources

Changelog

  • 2026-04-20 — Initial release: 1–4 legs, 7 strategy presets, payoff + break-evens + aggregated Greeks.
Planning estimates only — not financial, tax, or investment advice.