Chapter 25 · Extended Exercises

The Quant Desk Toolkit

Four exercises that turn abstract PDE theory into instruments you can actually build — mean reversion, yield curve consistency, Heston smiles, and Dupire calibration.
From theory to trading desk

Everything in Chapters 23–25 was architecture. This chapter is the toolbox that sits on top of it. Four exercises, four specific problems every quant faces in the real market. Each one takes a PDE result from earlier and turns it into a usable formula, a consistency check, or a calibration engine. Think of this as the manual for your quantitative workbench.

Four tools on the quant workbench — mean reversion, yield curve, Heston smile, Dupire surface Four coloured tool boxes showing the four exercises: linear SDE for mean reversion, no-arbitrage lambda for yield curve, Heston model for volatility smile, and Dupire formula for local vol surface. Ex 6.1 Linear SDE Mean reversion Ex 6.2 Market Price of Risk Yield curve consistency Ex 6.7 Heston Model Volatility smile Ex 6.10 Dupire Formula Model calibration

Four tools — four distinct problems every quant desk must solve.

Tool 1 · Exercise 6.1 — Linear SDEs: the exact solution
Ex 6.1
The Master Key for Mean-Reverting Models
Mean Reversion

Most SDEs have no closed-form solution — you simulate. But when the drift and diffusion are linear in X, an exact formula exists. This is the master key for Vasicek, Ornstein-Uhlenbeck, and Hull-White models:

dX = (a + bX)dt + (c + σX)dW
Closed-form solution exists if drift and volatility are linear in X.

The general solution uses an integrating factor e^(−bt). For the Vasicek model (c = 0, σ constant), this gives:

R(t) = R(0)·e^(−βt) + (α/β)(1 − e^(−βt)) + σ∫₀ᵗ e^(−β(t−u)) dW(u)
Three terms: decay of initial rate + pull toward long-run mean α/β + Gaussian noise integral (known distribution)

The key payoff: R(t) is normally distributed at every time t — mean and variance can be computed analytically. No Monte Carlo needed. The probability that the rate exceeds any threshold is a simple normal CDF calculation.

Linear SDE exact distribution — Vasicek rate distribution at three future times Three normal distribution curves shown at different future times T equals 0.5, 1, and 2 years. The distributions widen and shift toward the long-run mean as time increases. T = 0.5yr T = 1yr T = 2yr (converging to mean) Long-run mean α/β R(0) Mean Rate level →

The Vasicek distribution at T = 0.5yr (green, narrow), T = 1yr (blue, medium), T = 2yr (purple, wide). All Gaussian — all analytically computable without simulation.

Use this when: your strategy involves a mean-reverting spread, rate, or factor. The closed-form distribution lets you compute the probability of a spread exceeding your entry threshold without running a single path simulation. This is the mathematical engine behind Pairs Trading and Z-score mean reversion strategies.

Tool 2 · Exercise 6.2 — No-arbitrage and the market price of risk
Ex 6.2
The Yield Curve Consistency Check
Yield Curve

Two bonds driven by the same short rate R(t) must have the same reward-to-risk ratio. If not, an arbitrage exists: short the bond with the lower Sharpe ratio, long the other, cancel the dW term, and collect riskless profit. The no-arbitrage condition pins a single Market Price of Risk λ that all bonds must share:

(α₁ − r) / σ₁ = (α₂ − r) / σ₂ = λ(t, R)
α₁, α₂ = expected returns of each bond  |  σ₁, σ₂ = their rate sensitivities (volatilities)  |  λ = market price of interest rate risk

λ is the single number that must be consistent across the entire yield curve. It tells you how many units of expected return the market demands per unit of interest rate volatility. When you specify a short-rate model (Vasicek, CIR, Hull-White), you must also specify λ. If λ is inconsistent across maturities, your model has an arbitrage leak.

Lambda consistency — all bond Sharpe ratios must equal the same lambda to prevent arbitrage A yield curve with three bonds marked at different maturities. Each bond has its own alpha and sigma. An arrow points to all three Sharpe ratios equalling lambda, and a red cross shows what happens when they differ. 2Y 5Y 10Y (α−r)/σ = λ ✓ If λ₂ ≠ λ₅ ≠ λ₁₀ → Arbitrage exists! Short Long →

All bonds on the same yield curve must share one λ. A model that assigns different λ values to different maturities contains a free lunch — and will fail in live trading.

Use this when: building or calibrating a multi-maturity fixed income model. Before trusting any yield curve model, compute the implied λ for each maturity. If they differ by more than model noise, you have an arbitrage in your model. This check costs two lines of code and can save an entire interest rate strategy from structural mispricing.

Tool 3 · Exercise 6.7 — Heston's stochastic volatility model
Ex 6.7
The Volatility Smile — When σ Has Its Own SDE
Vol Smile

Standard BSM treats σ as a constant. But implied volatility from market prices is never flat — it smiles. The Heston Model gives volatility its own mean-reverting SDE, turning the problem into a 2D Feynman-Kac PDE where S and V are the two state variables.

dS = rS dt + √V · S · dW₁
dV = κ(θ − V) dt + ξ√V · dW₂  ,   dW₁dW₂ = ρ dt
κ = mean reversion speed  |  θ = long-run variance  |  ξ = vol-of-vol  |  ρ = correlation (usually −0.6 to −0.8 for equities)

The Heston PDE adds three new terms to BSM — vol drift, vol Gamma, and the correlation term ρ·ξ·√V·S·C_{SV}:

[BSM terms] + ½ξ²V·C_{VV} + κ(θ−V)·C_V + ρ·ξ·√V·S·C_{SV} = rC
The C_{SV} cross-term is the "secret sauce" — it creates the asymmetric smile (skew) seen in equity markets.
κ
Mean reversion
How fast vol returns to θ. High κ = vol normalises quickly after spikes.
θ
Long-run variance
The "natural" level of volatility. Vol gravitates here over time.
ξ
Vol-of-vol
How much volatility itself varies. Controls the "fatness" of the smile wings.
ρ
Leverage correlation
Equity markets: ρ ≈ −0.7. When stocks fall, vol spikes. This creates the skew.
V(0)
Initial variance
Current instantaneous variance = σ² now. Starting point of the vol process.
C_{SV}
Cross-gamma
The key new term. Mixes S-sensitivity with V-sensitivity. Generates asymmetric skew.

The reason equity implied vol is skewed (OTM puts more expensive than OTM calls) is precisely ρ < 0. When stocks drop, volatility spikes. OTM puts are protection against exactly that scenario — so they cost more. The Heston C_{SV} term is what mathematically creates this skew. Without it, the model produces a symmetric smile and systematically underprices crash protection.

Tool 4 · Exercises 6.8 & 6.9 — backward vs forward: two directions of time

Kolmogorov Backward
(Pricing)

Start at the future payoff and solve backward to find the price today. This is what Feynman-Kac does — and what BSM does. Time runs from T → t.

Vₜ + β·Vₓ + ½γ²·Vₓₓ = r·V

Use for: option pricing, hedge ratios, Greeks. Input = payoff at T. Output = fair value at t.

Kolmogorov Forward
(Fokker-Planck)

Start at today's price and propagate the probability density forward. The density spreads and drifts as time passes. Time runs from t → T.

pₜ = −∂(β·p)/∂x + ½∂²(γ²·p)/∂x²

Use for: VaR, probability of breaching a level, density of future prices. Input = current price. Output = distribution at T.

Backward vs forward — backward prices options from payoff to today, forward spreads density from today to future A timeline showing today on the left and expiry T on the right. Above the timeline, an arrow runs right-to-left labelled Backward Equation pricing. Below the timeline, an arrow runs left-to-right labelled Forward Equation density. Both use the same SDE. t Today T Expiry Backward (T → t): Pricing — "what is it worth today?" Forward (t → T): Density — "where will it be?" (VaR) h(S(T)) density

Same SDE, two directions. Backward gives you prices. Forward gives you probability densities — the foundation of risk management and VaR.

The forward (Fokker-Planck) equation is the engine of Dupire's formula (Exercise 6.10). By propagating the density forward under a local volatility model, Dupire derived the exact formula for what σ(T, K) must be to match every observed market option price simultaneously. The backward and forward equations are mathematically adjoint — they are transposes of each other in the space of probability densities.

Tool 5 · Exercise 6.10 — Dupire's formula: model calibration to the market
Ex 6.10
The Local Volatility Surface — Extracting σ(T,K) from Market Prices
Calibration

If the market quotes call option prices C(T, K) for every maturity T and strike K, Dupire's formula extracts the exact local volatility σ(T, K) that is consistent with all of these prices simultaneously. It runs the forward equation in reverse — instead of asking "given σ, what prices does the model produce?", it asks "given the prices, what σ must the model use?"

σ²(T, K) = (C_T + rK·C_K) / (½K²·C_{KK})
C_T = ∂C/∂T (how option price changes with maturity)  |  C_K = ∂C/∂K (delta, how price changes with strike)
C_{KK} = ∂²C/∂K² (gamma in strike space = risk-neutral density of S(T))
The denominator K²C_{KK}/2 is the Breeden-Litzenberger formula for the risk-neutral density

The numerator captures how option prices change through time (the cost of carry). The denominator captures how option prices curve across strikes (the probability mass at each stock level). Their ratio is the market-implied variance at that specific (T, K) point.

Theoretical Dupire local vol surface σ(T, K) — higher near the money, term structure sloping downward. Each point is what the market implies for that specific maturity and strike.

Dupire's formula is why quant desks can match every market price exactly on day one. It is the bridge between theory and the trading screen. The local vol surface is recalibrated every morning when the options market opens. Any deviation of your model prices from market prices after calibration is a model error — Dupire's formula eliminates systematic miscalibration by construction. The downside: local vol models predict future smiles poorly. Stochastic vol models (Heston) predict future smiles better but match today's prices less cleanly.

Try it — the quant desk workbench

Select a tool and explore it interactively. The Mean Reversion tool shows the Vasicek rate distribution at future times. The Vol Smile tool shows how Heston's ρ and ξ create the smile. The Lambda Check tool tests yield curve consistency.

3.0%
6.0%
0.5
1.2%
Output 1
Output 2
Output 3
Status
The quant desk cheat sheet
Ex 6.1 — Linear SDE
Mean Reversion Math
Closed-form distribution for Vasicek/OU processes. Compute probability of spread exceeding threshold analytically. No Monte Carlo needed.
When: pairs trading, rate model, factor mean reversion
Ex 6.2 — Market Price of Risk
Yield Curve Consistency
Verify that all bonds in your model imply the same λ = (α−r)/σ. If not, the model arbitrages itself. Essential QA step for any fixed income strategy.
When: multi-maturity bond model, rate strategy validation
Ex 6.7 — Heston Model
Volatility Smile Modeling
Stochastic vol with ρ < 0 creates skew. The C_{SV} cross-term generates asymmetric implied vol. Use when BSM smile mismatch is too large to ignore.
When: equity options, OTM put pricing, crash protection
Ex 6.10 — Dupire Formula
Model Calibration
Extract σ(T,K) from all observable option prices simultaneously. Guarantees perfect match to market on day one. Recalibrate every morning.
When: options market making, exotic pricing, vol surface build

Chapter 26 — the quant desk toolkit in five ideas: