Implementation:Avhz RustQuant HullWhite Process
| Knowledge Sources | |
|---|---|
| Domains | Stochastic_Processes, Quantitative_Finance |
| Last Updated | 2026-02-07 19:00 GMT |
Overview
Concrete implementation of the Hull-White (one-factor) short-rate model provided by the RustQuant library.
Description
The Hull-White model is a no-arbitrage, mean-reverting short-rate model defined by the SDE:
dX(t) = [theta(t) - alpha(t) * X(t)] dt + sigma(t) dW(t)
where alpha is the mean reversion speed, theta(t) is the time-dependent mean reversion function calibrated to fit the initial term structure, and sigma(t) is the volatility. The model extends the Vasicek model by allowing theta to be time-dependent, enabling exact calibration to the observed yield curve.
Key parameters:
- alpha (ModelParameter) -- Mean reversion speed (long-run mean)
- sigma (ModelParameter) -- Volatility (non-negative)
- theta (ModelParameter) -- Mean reversion target function (non-negative)
Usage
Use this process for modeling short rates when you need a calibrated no-arbitrage model for interest rate derivative pricing. The Hull-White model is one of the most widely used short-rate models in practice, balancing analytical tractability with the ability to fit the current term structure.
Code Reference
Source Location
- Repository: RustQuant
- File: crates/RustQuant_stochastics/src/hull_white.rs
- Lines: 1-104
Signature
pub struct HullWhite {
pub alpha: ModelParameter,
pub sigma: ModelParameter,
pub theta: ModelParameter,
}
impl HullWhite {
pub fn new(
alpha: impl Into<ModelParameter>,
sigma: impl Into<ModelParameter>,
theta: impl Into<ModelParameter>,
) -> Self
}
impl StochasticProcess for HullWhite {
fn drift(&self, x: f64, t: f64) -> f64
fn diffusion(&self, _x: f64, t: f64) -> f64
fn jump(&self, _x: f64, _t: f64) -> Option<f64>
fn parameters(&self) -> Vec<f64>
}
Import
use RustQuant::stochastics::HullWhite;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| alpha | impl Into<ModelParameter> | Yes | Mean reversion speed |
| sigma | impl Into<ModelParameter> | Yes | Volatility (non-negative) |
| theta | impl Into<ModelParameter> | Yes | Mean reversion target function |
Outputs
| Name | Type | Description |
|---|---|---|
| drift() | f64 | Returns theta(t) - alpha(t) * x -- mean-reverting drift |
| diffusion() | f64 | Returns sigma(t) -- the diffusion component |
| jump() | Option<f64> | Always returns None (no jump component) |
| parameters() | Vec<f64> | Returns [alpha(0), sigma(0), theta(0)] |
Usage Examples
use RustQuant::stochastics::HullWhite;
use RustQuant::stochastics::{StochasticProcessConfig, StochasticScheme};
// Create a Hull-White process with alpha=2.0, sigma=2.0, theta=0.5
let hw = HullWhite::new(2.0, 2.0, 0.5);
// Configure simulation: x0=10.0, t_start=0.0, t_end=1.0, n_steps=150, 1000 paths
let config = StochasticProcessConfig::new(
10.0, 0.0, 1.0, 150, StochasticScheme::EulerMaruyama, 1000, false, None
);
let output = hw.generate(&config);
// Access simulated paths
let paths = &output.paths;