Interest rates are fundamental to modern financial markets, influencing everything from bond prices and yield curves to the valuation of complex derivatives. Unlike equity prices, interest rates exhibit distinctive dynamics, including mean reversion and a strong dependence on the term structure. In this article we will derive the Hull-White formula and use it to price an option.

What’s the Hull-White model and how to implement it in C++?
1. What is the Hull-White Model?
The Hull–White model is a stochastic interest rate model widely used in quantitative finance to describe the evolution of short-term interest rates. Developed by John Hull and Alan White, it extends the classical Vasicek model by introducing a time-dependent drift that allows the model to fit the current market yield curve.
It belongs to the family of one-factor short-rate models, where the entire evolution of interest rates is driven by a single source of randomness.
The model is particularly useful for pricing interest rate derivatives, including:
- Interest rate swaps and swaptions: Valuation of fixed-for-floating swaps and options to enter into swap agreements.
- Caps and floors: Pricing options that protect against movements in floating interest rates.
- Callable bonds: Valuation of bonds containing embedded early redemption options.
- Bermudan swaptions: Pricing instruments with multiple exercise opportunities, often using numerical methods such as trinomial trees.
- Interest rate risk management: Simulating future interest rate scenarios for valuation and risk analysis.
2. The Hull-White Equation
The Hull–White model can be understood as an extension of the Vasicek model.
The Vasicek model assumes a constant long-term mean rate and gives the variation of short-term interest rate:

By contrast, Hull–White replaces the constant drift component with a time-dependent function:

Where:

The equation describes the evolution of the short-term interest rate, combining a time-dependent drift, a mean-reversion term and a stochastic component driven by Brownian motion.
In the Hull–White framework, the drift function is chosen to match the market’s initial term structure:

Here, f(0, t) represents the instantaneous forward interest rate observed at time zero for maturity t.
By modelling the drift and volatility of short-term interest rates, the Hull–White model determines the distribution of future bond prices, allowing us to price bond options analytically from their expected discounted payoffs.
3. Why is the Hull-White Model Popular in Quantitative Finance?
The Hull–White model is widely used in quantitative finance because it offers a practical balance between mathematical tractability, market calibration, and computational efficiency. Its ability to reproduce the initial yield curve while modelling stochastic interest rate movements makes it particularly attractive for pricing and managing interest rate derivatives.
Several characteristics explain its popularity:
- Exact fit to the initial yield curve: The time-dependent drift function allows the model to reproduce observed discount factors, ensuring consistency with the initial market term structure.
- Mean reversion: Interest rates tend to move toward a time-dependent equilibrium level, providing a useful representation of short-rate dynamics.
- Analytical tractability: The Gaussian structure provides closed-form solutions for zero-coupon bond prices and certain European interest rate options, reducing computational costs.
- Efficient numerical methods: More complex products, such as Bermudan swaptions and callable bonds, can be priced using trinomial trees, finite-difference methods, or Monte Carlo simulations.
- Calibration to market instruments: Model parameters can be calibrated to interest rate options, particularly caps, floors, and swaptions, to capture market-implied volatility levels.
- Practical C++ implementation: Its relatively simple stochastic differential equation and analytical properties make it well suited to efficient implementations using standard C++, QuantLib, and numerical libraries.
4. A C++ Implementation with Quantlib
QuantLib is an open-source C++ library widely used in quantitative finance for modelling, pricing, and risk management. It provides a built-in implementation of the one-factor Hull–White model through the QuantLib::HullWhite class.
In this example, we will construct a Hull–White model, define an initial interest rate curve, and use the model to price a zero-coupon bond and a European option on that bond.
#include <ql/quantlib.hpp>
#include <iostream>
#include <iomanip>
int main() {
using namespace QuantLib;
// 1. Set evaluation date
Date today(11, October, 2026);
Settings::instance().evaluationDate() = today;
// 2. Build a flat yield curve at 3%
Rate interestRate = 0.03;
DayCounter dayCounter = Actual365Fixed();
Handle<YieldTermStructure> yieldCurve(
ext::make_shared<FlatForward>(
today, interestRate, dayCounter, Continuous
)
);
// 3. Initialize the Hull-White model
Real a = 0.10; // Mean reversion
Real sigma = 0.01; // Short-rate volatility
auto model = ext::make_shared<HullWhite>(
yieldCurve, a, sigma
);
// 4. Price a 5-year zero-coupon bond
Time t = 0.0;
Time T = 5.0;
Rate r0 = interestRate;
Real bondPrice = model->discountBond(t, T, r0);
// 5. Price a European call on the bond
Option::Type optionType = Option::Call;
Real strike = 0.90;
Time optionExpiry = 2.0;
Time bondMaturity = 5.0;
Real optionPrice = model->discountBondOption(
optionType,
strike,
optionExpiry,
bondMaturity
);
// 6. Display results
std::cout << std::fixed << std::setprecision(6);
std::cout << "Hull-White Model\n";
std::cout << "--------------------------\n";
std::cout << "Interest rate: " << interestRate << "\n";
std::cout << "Mean reversion: " << a << "\n";
std::cout << "Volatility: " << sigma << "\n";
std::cout << "5Y zero-coupon bond: " << bondPrice << "\n";
std::cout << "European bond call: " << optionPrice << "\n";
return 0;
}By modelling how short-term interest rates evolve, the Hull–White model determines the distribution of future bond prices, allowing us to calculate the expected payoff of a bond option and discount it to its present value.
Save the code above as hull_white.cpp, then compile against an installed QuantLib library:
g++ -std=c++17 -O2 hull_white.cpp -o hull_white \
$(pkg-config --cflags --libs quantlib)Now, you can run:
./hull_whiteAnd you’re done.
Another interesting video on the topic:
https://www.youtube.com/watch?v=vlXtQYbS4K4
5. Conclusion
In this article, we explored the Hull–White interest rate model, from its mathematical foundations to a practical implementation in C++ using QuantLib.
We started with the stochastic differential equation describing short-term interest rates, examining how drift, mean reversion, and volatility determine their evolution. We then explained how the time-dependent drift allows the model to fit the initial market yield curve.
From there, we connected interest rate dynamics to derivatives pricing: by modelling the distribution of future interest rates, Hull–White determines the distribution of future bond prices, making it possible to calculate the expected discounted payoff of an option.
Finally, we translated this theory into C++ using QuantLib, constructing a yield curve, initializing the Hull–White model, pricing a five-year zero-coupon bond, and computing the price of a European bond call option using discountBondOption().
The key takeaway is that a stochastic equation describing interest rate movements can become a practical derivatives pricing engine with just a few lines of C++. This makes Hull–White an excellent introduction to the connection between stochastic calculus, quantitative modelling, and real-world financial software.
