Quantij quantitative finance education and research

Hull–White Model: Fit the Yield Curve and Price Options

Build the one-factor Hull–White model, fit today’s discount curve, and calibrate to bond options in Python.

Published 27 November 2026 · 20 min read

The idea: separate the curve from the shocks

Start with a curve of discount factors from market instruments. Bootstrapping means solving each new curve pillar so that its associated instrument reprices using the earlier pillars and the chosen interpolation. For collateralised derivatives, use the discount curve appropriate to the collateral agreement. A separate curve can be required to forecast floating coupons.

Define f0(t)=−∂tlog⁡P0(t)f_0(t)=-\partial_t\log P_0(t), where P0(t)P_0(t) is today’s discount factor. Hull–White splits the short rate into a zero-mean stochastic factor and a deterministic shift.

dxt=−axt dt+σ dWtQ,x0=0,rt=xt+ϕ(t).dx_t=-a x_t\,dt+\sigma\,dW_t^{\mathbb Q},\quad x_0=0,\qquad r_t=x_t+\phi(t).

From Gaussian discounting, log⁡P0(T)=−∫0Tϕ(s) ds+12Var(∫0Txs ds)\log P_0(T)=-\int_0^T\phi(s)\,ds+\tfrac12\mathrm{Var}(\int_0^T x_s\,ds). Differentiate with respect to maturity. The variance derivative is the squared Brownian kernel at horizon TT, yielding the shift.

ϕ(t)=f0(t)+σ22a2(1−e−at)2.\phi(t)=f_0(t)+\frac{\sigma^2}{2a^2}(1-e^{-at})^2.

The SDE and exact simulation

Differentiate the shift and substitute xt=rt−ϕ(t)x_t=r_t-\phi(t) to get the SDE. Here θ\theta is a drift intercept. If your library writes a[m(t)−rt]a[m(t)-r_t], then m(t)=θ(t)/am(t)=\theta(t)/a.

drt=[θ(t)−art] dt+σ dWt,θ(t)=f0′(t)+af0(t)+σ22a(1−e−2at).dr_t=[\theta(t)-ar_t]\,dt+\sigma\,dW_t,\qquad \theta(t)=f_0'(t)+af_0(t)+\frac{\sigma^2}{2a}(1-e^{-2at}).

Simulate xx directly to avoid differentiating the forward curve in the drift. With Z∼N(0,1)Z\sim\mathcal N(0,1), the next state is:

xt+h=xte−ah+σ1−e−2ah2a Z.x_{t+h}=x_te^{-ah}+\sigma\sqrt{\frac{1-e^{-2ah}}{2a}}\,Z.

Add the shift at each grid time. Check time-step convergence when using numerical integration of the rate for discounting. If you need exact discounting, sample the Gaussian integral jointly with the next state.

Price a zero-coupon bond

Set B(t,T)=(1−e−a(T−t))/aB(t,T)=(1-e^{-a(T-t)})/a and vx(t)=σ2(1−e−2at)/(2a)v_x(t)=\sigma^2(1-e^{-2at})/(2a). Integrating the future factor conditional on its current value yields the affine bond formula:

P(t,T)=P0(T)P0(t)exp⁡[−B(t,T)(rt−f0(t))−12vx(t)B(t,T)2].P(t,T)=\frac{P_0(T)}{P_0(t)}\exp\left[-B(t,T)(r_t-f_0(t))-\tfrac12 v_x(t) B(t,T)^2\right].

At t=0t=0 the exponent vanishes because r0=f0(0)r_0=f_0(0) and vx(0)=0v_x(0)=0. At maturity B(T,T)=0B(T,T)=0. Verify both identities numerically. Curve interpolation also matters: a continuous discount function may still have discontinuous forwards. Check the interpolation and extrapolation assumptions against your product horizons.

Calibrate to options, then check the fit

Under the expiry-forward measure, the bond forward F=P0(T)/P0(S)F=P_0(T)/P_0(S) is lognormal with total log standard deviation ν=B(S,T)vx(S)\nu=B(S,T)\sqrt{v_x(S)}. For a strike K>0K>0, the call is:

C0=P0(S)[FΦ(d1)−KΦ(d2)],d1=log⁡(F/K)ν+ν2,d2=d1−ν.C_0=P_0(S)[F\Phi(d_1)-K\Phi(d_2)],\qquad d_1=\frac{\log(F/K)}{\nu}+\frac{\nu}{2},\qquad d_2=d_1-\nu.

If ν=0\nu=0, use the discounted intrinsic value. Changing the expiry and underlying maturity changes how the quote responds to aa and σ\sigma. Fit across both dimensions and inspect the residual surface rather than trusting one aggregate error.

The following code calibrates to synthetic bond-option prices at four expiry–maturity pairs. It is a parameter-recovery exercise. It does not use live quotes.

from math import exp, expm1, log, sqrt
from scipy.optimize import least_squares
from scipy.special import ndtr

def p0(t):
    return exp(-0.035*t)

def bond_call(s, t, strike, a, sigma):
    b = -expm1(-a*(t-s))/a
    v = sigma**2 * (-expm1(-2*a*s))/(2*a)
    nu = b*sqrt(v)
    f = p0(t)/p0(s)
    if nu == 0:
        return p0(s)*max(f-strike, 0)
    d1 = log(f/strike)/nu + nu/2
    return p0(s)*(f*ndtr(d1)-strike*ndtr(d1-nu))

contracts = [(s,t,p0(t)/p0(s)) for s,t in [(1,3),(1,8),(3,7),(5,15)]]
prices = [bond_call(*c,.12,.009) for c in contracts]

def residual(params):
    return [1e4*(bond_call(*c,*params)-price)
            for c,price in zip(contracts,prices)]

fit = least_squares(residual, [.2,.015], bounds=([.001,.0001],[2,.1]))
assert fit.success and max(abs(fit.fun)) < 1e-6

From caps and swaptions to a calibration basket

Caps consist of caplets with different fixing dates. Convert quoted normal or shifted-lognormal volatilities to prices using the supplied quote conventions. In a single-curve setup, each caplet can be expressed using a discount-bond option. In a multi-curve setup, handle the forwarding spread and discounting conventions explicitly.

For a European swaption in the standard single-curve one-factor setting with the required monotonicity, Jamshidian’s decomposition finds the short rate at expiry where the underlying coupon-bond value equals the strike equivalent. It then prices the payoff as a sum of zero-coupon bond options. Use the correct exercise date, coupon schedule and settlement convention. Bermudan exercise requires a numerical procedure such as a tree, PDE, or regression Monte Carlo.

Minimise ∑i[(Vimodel−Vimarket)/si]2\sum_i [(V_i^{\mathrm{model}}-V_i^{\mathrm{market}})/s_i]^2, where sis_i can be a bid–ask scale with a sensible floor. Compare fitted quotes across expiry and tenor and inspect scenarios in which two parameter sets give similar errors. Refit after perturbing quotes to see whether aa is actually identified.

Build a practical validation checklist

Reprice all bootstrapping instruments first. Confirm call–put parity for bond options and agreement between the analytic formula and Monte Carlo within sampling error. Compare changes under curve bumps, volatility bumps and alternate interpolation. For a callable product, check convergence in both state resolution and the time grid.

One factor cannot capture independent changes in curve level, slope and curvature. Constant volatility also limits the fit across option expiries. A piecewise volatility can improve expiry fit, but adds degrees of freedom that should be validated out of sample.

From synthetic examples to market calibration

Convert market vol quotes to prices using the correct quote convention, then price each cap or swaption with its own cash flows. Compare errors to bid–ask spreads and perturb inputs to see whether a and σ are stable. A single Gaussian factor can match the initial curve while still missing volatility smiles and independent movements across curve tenors.

Sources