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 BlackDermanToy

From Leeroopedia


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

Overview

Concrete implementation of the Black-Derman-Toy (BDT) short-rate model provided by the RustQuant library.

Description

The Black-Derman-Toy model is a one-factor short-rate model used for pricing interest rate derivatives. It models the evolution of the short rate via the SDE:

dX(t) = [theta(t) + (sigma'(t)/sigma(t)) * X(t)] dt + sigma(t) dW(t)

where theta(t) is a time-dependent drift function calibrated to match the current term structure, sigma(t) is the time-dependent instantaneous volatility, and sigma'(t)/sigma(t) represents the relative rate of change of volatility (computed via central difference differentiation).

Key parameters:

  • sigma (ModelParameter) -- Instantaneous volatility
  • theta (ModelParameter) -- Value related to drift calibration at option expiry

Usage

Use this process for modeling short-rate dynamics in interest rate derivative pricing when you need to calibrate to both the current yield curve and the volatility term structure. The BDT model is a lognormal short-rate model, ensuring non-negative interest rates.

Code Reference

Source Location

Signature

pub struct BlackDermanToy {
    pub sigma: ModelParameter,
    pub theta: ModelParameter,
}

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

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

I/O Contract

Inputs

Name Type Required Description
sigma impl Into<ModelParameter> Yes Instantaneous volatility (constant or time-dependent)
theta impl Into<ModelParameter> Yes Time-dependent drift calibration function

Outputs

Name Type Description
drift() f64 Returns theta(t) + (sigma'(t)/sigma(t)) * x -- state-dependent drift with volatility derivative
diffusion() f64 Returns sigma(t) -- the diffusion component at time t
jump() Option<f64> Always returns None (no jump component)
parameters() Vec<f64> Returns [sigma(0), theta(0)]

Usage Examples

use RustQuant::stochastics::BlackDermanToy;
use RustQuant::stochastics::{StochasticProcessConfig, StochasticScheme};

// Create a BDT process with constant sigma=0.13 and theta=1.5
let bdt = BlackDermanToy::new(0.13, 1.5);

// Configure simulation: x0=0.13, t_start=0.0, t_end=1.0, n_steps=100, 1000 paths
let config = StochasticProcessConfig::new(
    0.13, 0.0, 1.0, 100, StochasticScheme::EulerMaruyama, 1000, false, None
);

let output = bdt.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