Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Avhz RustQuant BSM Model Constructors

From Leeroopedia


Knowledge Sources
Domains Derivatives, Option_Pricing, Mathematical_Finance
Last Updated 2026-02-07 20:00 GMT

Overview

Concrete tool for instantiating Black-Scholes-Merton family pricing model parameter structs provided by the RustQuant instruments crate.

Description

RustQuant implements the generalized BSM framework as a set of parameter structs, each with a new() constructor. All GBSM variants (BlackScholes73, Merton73, Black76, Asay82, GarmanKohlhagen83) implement the GeneralisedBlackScholesMerton trait via the impl_gbsm! macro, providing unified access to pricing and Greeks. The Heston93 and Bachelier models have their own independent pricing methods.

Each struct encapsulates market parameters and exposes internal accessors s(), r(), and b() that define the cost-of-carry relationship.

Usage

Import the appropriate model struct when you know the underlying asset type and need to set market parameters for analytic pricing. Combine with AnalyticOptionPricer to compute prices and Greeks.

Code Reference

Source Location

  • Repository: RustQuant
  • File: crates/RustQuant_instruments/src/options/option_models.rs
  • Lines: L18-298 (struct definitions and constructors)

Signature

// Black-Scholes (1973) - equity options, no dividends
pub struct BlackScholes73 { s: f64, r: f64, v: f64 }
impl BlackScholes73 {
    pub fn new(s: f64, r: f64, v: f64) -> Self
    // b() = r
}

// Merton (1973) - equity options with continuous dividends
pub struct Merton73 { s: f64, r: f64, q: f64, v: f64 }
impl Merton73 {
    pub fn new(s: f64, r: f64, q: f64, v: f64) -> Self
    // b() = r - q
}

// Black (1976) - futures options
pub struct Black76 { f: f64, r: f64, v: f64 }
impl Black76 {
    pub fn new(f: f64, r: f64, v: f64) -> Self
    // b() = 0
}

// Asay (1982) - margined futures options
pub struct Asay82 { f: f64, v: f64 }
impl Asay82 {
    pub fn new(f: f64, v: f64) -> Self
    // b() = 0, r() = 0
}

// Garman-Kohlhagen (1983) - FX options
pub struct GarmanKohlhagen83 { s: f64, r_d: f64, r_f: f64, v: f64 }
impl GarmanKohlhagen83 {
    pub fn new(s: f64, r_d: f64, r_f: f64, v: f64) -> Self
    // b() = r_d - r_f
}

// Heston (1993) - stochastic volatility
pub struct Heston93 { s: f64, v: f64, r: f64, q: f64, rho: f64, kappa: f64, theta: f64, sigma: f64 }
impl Heston93 {
    pub fn new(s: f64, v: f64, r: f64, q: f64, rho: f64, kappa: f64, theta: f64, sigma: f64) -> Self
}

// Bachelier (1900) - normal model
pub struct Bachelier { f: f64, r: f64, v: f64 }
impl Bachelier {
    pub fn new(f: f64, r: f64, v: f64) -> Self
}

Import

use RustQuant::instruments::{
    BlackScholes73, Merton73, Black76, Asay82,
    GarmanKohlhagen83, Heston93, Bachelier,
};

I/O Contract

Inputs

Name Type Required Description
s f64 Yes (BS73, Merton73, GK83) Spot price of the underlying
f f64 Yes (Black76, Asay82, Bachelier) Forward price
r f64 Yes (most models) Risk-free interest rate
v f64 Yes Volatility (sigma)
q f64 Yes (Merton73, Heston93) Continuous dividend yield
r_d f64 Yes (GK83) Domestic risk-free rate
r_f f64 Yes (GK83) Foreign risk-free rate
rho f64 Yes (Heston93) Correlation between asset and variance processes
kappa f64 Yes (Heston93) Mean-reversion speed of variance
theta f64 Yes (Heston93) Long-run variance level
sigma f64 Yes (Heston93) Volatility of variance (vol-of-vol)

Outputs

Name Type Description
return Model struct A pricing model struct implementing GeneralisedBlackScholesMerton trait (or independent methods for Heston93/Bachelier)

Usage Examples

Standard Black-Scholes

use RustQuant::instruments::BlackScholes73;

// Equity option: spot=100, rate=5%, vol=20%
let bs = BlackScholes73::new(100.0, 0.05, 0.20);

Merton with Dividends

use RustQuant::instruments::Merton73;

// Dividend-paying equity: spot=100, rate=5%, div_yield=2%, vol=20%
let merton = Merton73::new(100.0, 0.05, 0.02, 0.20);

Heston Stochastic Volatility

use RustQuant::instruments::Heston93;

// s=100, v=0.04, r=5%, q=2%, rho=-0.7, kappa=2.0, theta=0.04, sigma=0.3
let heston = Heston93::new(100.0, 0.04, 0.05, 0.02, -0.7, 2.0, 0.04, 0.3);

FX Option

use RustQuant::instruments::GarmanKohlhagen83;

// EUR/USD: spot=1.10, domestic_rate=5%, foreign_rate=3%, vol=10%
let gk = GarmanKohlhagen83::new(1.10, 0.05, 0.03, 0.10);

Related Pages

Implements Principle

Requires Environment

Page Connections

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