Black-Scholes Solver
Pure math option pricer with all the Greeks.
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.
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.
C = S·N(d₁) − K·e^(−rT)·N(d₂)
Real Black-Scholes Solver bot, running on real Yahoo data when the symbol is available. Drag the params — the bot re-runs instantly.
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.
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,
},
};
},
};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.
- Copy the whole block above.
- On /quant, click + Import your bot in the bot library.
- Paste, hit save. It hot-loads into your workspace.
- Edit any param defaults or logic to your taste — it's now yours.
- ·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.
- ·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.
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).
What are the Greeks?+
Why doesn't this match my broker's price?+
Neural Black-Scholes — price + 5 Greeks in one shot.
CRR binomial tree distilled — handles early-exercise premium.
Stochastic-vol pricer — vol of vol, mean reversion, leverage.
Quantify the post-event vol drop on long options.
Sell cash-secured puts → assigned → sell covered calls.