Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Avhz RustQuant ExtendedVasicek

From Leeroopedia
Revision as of 14:31, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Avhz_RustQuant_ExtendedVasicek.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Stochastic_Processes, Quantitative_Finance
Last Updated 2026-02-07 19:00 GMT

Overview

Concrete implementation of the Extended Vasicek (time-dependent Hull-White) short-rate model provided by the RustQuant library.

Description

The Extended Vasicek model generalizes the classical Vasicek model by allowing time-dependent parameters. It is defined by the SDE:

dX(t) = [theta(t) - alpha(t) * X(t)] dt + sigma(t) dW(t)

where theta(t) is the time-dependent mean reversion target function, alpha(t) is the time-dependent mean reversion speed, and sigma(t) is the time-dependent volatility. When alpha and theta are constant, this reduces to the standard Hull-White model.

Key parameters:

  • alpha (ModelParameter) -- Mean reversion speed function (time-dependent)
  • sigma (ModelParameter) -- Volatility function (non-negative, time-dependent)
  • theta (ModelParameter) -- Mean reversion target function (time-dependent)

Usage

Use this process when modeling short rates with time-dependent parameters for exact calibration to the current term structure. The Extended Vasicek model provides more flexibility than the standard Vasicek or Hull-White models, allowing all three parameters to vary over time.

Code Reference

Source Location

Signature

pub struct ExtendedVasicek {
    pub alpha: ModelParameter,
    pub sigma: ModelParameter,
    pub theta: ModelParameter,
}

impl ExtendedVasicek {
    pub fn new(
        alpha: impl Into<ModelParameter>,
        sigma: impl Into<ModelParameter>,
        theta: impl Into<ModelParameter>,
    ) -> Self
}

impl StochasticProcess for ExtendedVasicek {
    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::ExtendedVasicek;

I/O Contract

Inputs

Name Type Required Description
alpha impl Into<ModelParameter> Yes Mean reversion speed (constant or time-dependent)
sigma impl Into<ModelParameter> Yes Volatility (non-negative, constant or time-dependent)
theta impl Into<ModelParameter> Yes Mean reversion target (constant or time-dependent)

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::ExtendedVasicek;
use RustQuant::stochastics::{StochasticProcessConfig, StochasticScheme};

// Create an Extended Vasicek process with alpha=2.0, sigma=2.0, theta=0.5
let ev = ExtendedVasicek::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 = ev.generate(&config);

// Access simulated paths
let paths = &output.paths;

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment