LIVE·
fetching live quotes from Yahoo Finance…
--:--:--UTC
Learn/Bots/Black-Scholes Solver
Optionsid · bs-solver
B

Black-Scholes Solver

Pure math option pricer with all the Greeks.

In plain English

Plug in 5 numbers (spot, strike, days, IV, rate), get the textbook fair price of an option plus all 5 Greeks. The Greeks are the option's vital signs: how sensitive its price is to the stock moving, time passing, and vol changing. Memorise these — every options trader knows them by heart.

No jargon. Just what this bot does.
The longer version

Plug in 5 numbers, get the textbook fair price of an option plus all 5 Greeks. The Greeks are the option's vital signs: how sensitive the price is to spot moves, time, and volatility. The single most important model in finance — every options trader knows what each Greek means by heart.

The math
formula
C = S·N(d₁) − K·e^(−rT)·N(d₂)
parameters
typeTypechoices: C, Pdefault · C
spotSpot $range 1 → 10000default · 100
strikeStrike $range 1 → 10000default · 100
daysDays to expiryrange 1 → 730default · 30
ivIV %range 1 → 200default · 32
rateRate %range 0 → 20default · 4.5
Live demo

Real Black-Scholes Solver bot, running on real Yahoo data when the symbol is available. Drag the params — the bot re-runs instantly.

symbolloading…
loading AMZN bars…
Source code · public

This is the actual code the bot runs — not a re-explanation, not a simplified version. Whatever ships here is what executes when you press Run All in the workbench. Read it, copy it, fork it, build a better one.

lib/quant/bots.ts·lines 743791
TypeScript · MIT-licensed
const bsBot: BotDef = {
  id: "bs-solver",
  name: "Black-Scholes Solver",
  category: "options",
  glyph: "B",
  tagline: "Pure math option pricer with all the Greeks.",
  formula: "C = S·N(d₁) − K·e^(−rT)·N(d₂)",
  params: [
    { key: "type", label: "Type", kind: "select", default: "C", options: [{ value: "C", label: "Call" }, { value: "P", label: "Put" }] },
    { key: "spot", label: "Spot $", kind: "number", default: 100, min: 1, max: 10000, step: 0.5 },
    { key: "strike", label: "Strike $", kind: "number", default: 100, min: 1, max: 10000, step: 0.5 },
    { key: "days", label: "Days to expiry", kind: "number", default: 30, min: 1, max: 730, step: 1 },
    { key: "iv", label: "IV %", kind: "number", default: 32, min: 1, max: 200, step: 0.5 },
    { key: "rate", label: "Rate %", kind: "number", default: 4.5, min: 0, max: 20, step: 0.1 },
  ],
  run: (ctx, p): BotResult => {
    const lastPx = ctx.candles[ctx.candles.length - 1]?.c ?? 100;
    const type = (p["type"] as string) === "P" ? "P" : "C";
    const spot = num(p, "spot", lastPx);
    const strike = num(p, "strike", Math.round(lastPx));
    const days = num(p, "days", 30);
    const iv = num(p, "iv", 32) / 100;
    const rate = num(p, "rate", 4.5) / 100;
    const t = Math.max(0.0005, days / 365);
    const r = priceOption(spot, strike, t, rate, iv, type as "C" | "P");
    const moneyness = type === "C" ? spot / strike : strike / spot;
    return {
      signals: [],
      metrics: [
        { key: "px", label: "Price", value: `$${r.price.toFixed(2)}`, tone: "info" },
        { key: "delta", label: "Δ Delta", value: fmtNum(r.greeks.delta, 3), tone: "neutral" },
        { key: "gamma", label: "Γ Gamma", value: fmtNum(r.greeks.gamma, 4), tone: "neutral" },
        { key: "theta", label: "Θ Theta /day", value: fmtNum(r.greeks.theta, 3), tone: "bear" },
        { key: "vega", label: "ν Vega /1%", value: fmtNum(r.greeks.vega, 3), tone: "neutral" },
        { key: "rho", label: "ρ Rho /1%", value: fmtNum(r.greeks.rho, 3), tone: "neutral" },
        { key: "money", label: "Moneyness", value: fmtNum(moneyness, 3), tone: moneyness > 1.05 ? "bull" : moneyness < 0.95 ? "bear" : "neutral" },
        { key: "premium", label: "Premium / spot", value: `${((r.price / spot) * 100).toFixed(2)}%`, tone: "info" },
      ],
      summary: `${type === "C" ? "Call" : "Put"} ${strike} @ ${days}d, IV ${(iv * 100).toFixed(1)}% → $${r.price.toFixed(2)}. Δ${r.greeks.delta.toFixed(2)} · Θ${r.greeks.theta.toFixed(3)}/day.`,
      beginner:
        "Plug in 5 numbers, get the textbook fair price of an option plus all 5 Greeks. The Greeks are the option's vital signs: how sensitive the price is to spot moves, time, and volatility.",
      verdict: {
        side: "hold",
        text: `Fair price $${r.price.toFixed(2)} (${((r.price / spot) * 100).toFixed(2)}% of spot). Compare against the chain.`,
        confidence: 1,
      },
    };
  },
};
what each piece means
  • id — unique key the workbench uses to find the bot.
  • params — the sliders + inputs you see on the cell.
  • run(ctx, p) — the function that gets called with candles + your params and returns the verdict.
  • verdict — the BUY / SELL / HOLD pill at the top of the cell.
  • metrics — the small stat boxes shown in the cell body.
use this code yourself
  1. Copy the whole block above.
  2. On /quant, click + Import your bot in the bot library.
  3. Paste, hit save. It hot-loads into your workspace.
  4. Edit any param defaults or logic to your taste — it's now yours.
Specialty · when it shines, when it fails
✓ Shines when
  • ·Sanity-checking live chain quotes. Anything more than 0.5% off the BS price is mispriced (or you've got the wrong IV).
  • ·Greeks at a glance. Especially useful for delta-hedging — the bot returns delta directly.
  • ·Options education. Drag the IV slider and watch theta and vega change — the dependencies become visceral.
✗ Fails when
  • ·American-style options where early exercise matters. Use the American Pricer instead.
  • ·Stochastic-vol regimes. BS assumes flat vol across strikes; real markets have skew. Use Heston for skew-aware pricing.
  • ·Discrete dividends. The bot ignores them; for dividend-paying stocks within the option's life, error grows.
How to read its verdict

Always HOLD — pricing bots don't trade. The interesting comparison is fair price vs the live chain bid/ask. Anything more than 0.5% off is mispriced. Premium-as-percent-of-spot is published as a sanity check (typically 1-5% for ATM monthlies).

FAQ
What are the Greeks?+
Δ Delta: dPrice/dSpot. Sensitivity to underlying moves. Γ Gamma: d²Price/dSpot². How fast delta changes. Θ Theta: dPrice/dt. Time decay. ν Vega: dPrice/dσ. Sensitivity to vol changes. ρ Rho: dPrice/dr. Sensitivity to rate changes. Memorise these.
Why doesn't this match my broker's price?+
Brokers use mid-market or live bid/ask, not BS fair value. They also adjust for dividends, early exercise, vol smile. The bot is the textbook formula — useful as a benchmark, not as a quote.