Derivatives for developers
Derivatives for developers. What the products are and why they exist, how they’re priced and risked, and what happens to a trade over its life — then the stochastic calculus behind the option pricers, taught at engineer’s level: every rule verified numerically before it’s derived, every page with a check that fails if you’ve misunderstood it.
Part 0 — Orientation
Notation, units (annualised vol, continuous vs simple rates, day counts), prerequisites, how to run the code.
Part 1 — Products
Each page: what it is · who needs it and why · how it’s priced · how it’s risked · lifecycle from booking to settlement.
Time value, discount factors, zero and forward curves, compounding conventions.
Cash-and-carry gives F = S·e^((r−q)T) with no stochastics at all; MTM value after inception; delta of one.
Exchange-traded forwards: clearing, initial and variation margin, daily settlement, rolling; why they exist (credit risk removed, liquidity); basis risk.
Interest rate swaps: PV(fixed) − PV(float), the par rate, why the floating leg is worth par at a reset; PV01 and bucketed curve risk; fixings, resets, netting, collateral.
Calls, puts, payoffs, moneyness, intrinsic vs time value; why they exist (asymmetry, leverage, income); European vs American. The price is the cost of hedging.
Capture → confirmation → settlement → lifecycle events → EOD risk and P&L → reporting. Why the batch reruns everything overnight.
Part 2 — Stochastic calculus
Engineer’s level: every rule is verified numerically before it’s derived. Python/numpy experiments while learning; the same invariants become library tests.
Variance adds, standard deviation doesn’t: √n. Why the continuous limit needs increments of size √dt.
Continuous everywhere, differentiable nowhere, and the same roughness at every magnification. Independent Gaussian increments, martingale, Markov; simulated as a cumulative sum of √dt·Z.
Σ(ΔW)² → T while Σ|ΔW| → ∞. The rulebook: (dW)² = dt, dW·dt = 0, (dt)² = 0. The whole reason ordinary calculus fails.
Left-endpoint sums and why (non-anticipation); ∫W dW = ½W_T² − ½T; zero mean, martingale, Itô isometry; Stratonovich as an aside.
Second-order Taylor plus the rulebook: df = (∂f/∂t + a·∂f/∂x + ½b²·∂²f/∂x²)dt + b·∂f/∂x dW. Worked: W², log S, e^(W−t/2).
dS = μS dt + σS dW; solve via log S; the −½σ² correction (mean vs median, volatility drag); exact sampling vs Euler–Maruyama; where the √dt comes from.
Π = V − ΔS; Itô on V; choose Δ = ∂V/∂S to kill dW; risk-free must earn r; μ vanishes.
V = e^(−rT)·E^Q[payoff]; drift becomes r; Girsanov as reweighting paths, not changing volatility; Feynman–Kac ties the expectation to the PDE.
Derive by integrating the lognormal against the payoff; what N(d₁) and N(d₂) mean; put–call parity; dividends; Black-76 for forwards and futures.
Delta, gamma, vega, theta, rho — what each measures and who watches it. The PDE re-read as a P&L statement: theta pays for gamma.
Constant vol, continuous frictionless trading, lognormal returns vs reality; smile and skew; why the model survives as a quoting convention (vol is the unit of price).
Part 3 — Implementation
N(x) numerics; edge cases (T→0, σ→0, deep ITM/OTM); units and conventions; reference implementation and its tests.
Exact GBM vs Euler; standard error and convergence; antithetics and control variates; seeds and reproducibility; parallelism; when MC is the only option.
Discretise the PDE; explicit, implicit, Crank–Nicolson; stability; American options via early exercise; when PDE beats MC.
Root finding; the surface as an object; interpolation; where it lives in the system and who owns it.
Analytic vs bump-and-revalue (bump sizes, MC noise) vs pathwise and AAD; what’s actually on the risk report.
Pricing library ↔ market data ↔ trade store ↔ risk engine; the EOD batch; P&L explain; model validation; why the quant’s library has separate model and calibration layers.
How the QuantLib-Python oracle generates the golden values, and how to read the library those values come from.
Part 4 — Later
v2 candidates, not commitments: vol surfaces properly (arbitrage-free interpolation, SVI) · local vol (Dupire) · stochastic vol (Heston) · jumps · rates (curve building, multi-curve, caps and swaptions, SABR) · exotics (barriers, Asians, digitals and why they’re hard to hedge) · American options in depth · counterparty risk (CVA) · credit (CDS).