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 Bachelier Backend

From Leeroopedia


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

Overview

Concrete tool for pricing European options using the Bachelier (normal) model and its modified (discounted) variant provided by the RustQuant library.

Description

This module implements two Bachelier-family pricing models:

  • Bachelier -- The classical Bachelier (1900) normal model where the underlying follows arithmetic Brownian motion. The price formula uses the absolute difference (S - K) scaled by the Gaussian CDF and PDF, with volatility expressed in absolute (dollar) terms rather than relative terms. There is no discounting.
  • ModifiedBachelier -- An extension that includes a risk-free rate discount factor exp(-r * T) applied to the Bachelier price, along with a dividend yield parameter. This struct supports the builder pattern via derive_builder.

Both models compute d1 = (S - K) / (v * sqrt(T)) and use the standard Gaussian CDF/PDF. Date handling uses the time crate with a default day count convention.

Usage

Use when pricing European options under the assumption of normally distributed (rather than log-normally distributed) underlying price changes. The Bachelier model is common in interest rate markets and for assets that can take negative values.

Code Reference

Source Location

Signature

pub struct Bachelier {
    pub underlying_price: f64,
    pub strike_price: f64,
    pub volatility: f64,
    pub evaluation_date: Option<Date>,
    pub expiration_date: Date,
    pub option_type: TypeFlag,
}

impl Bachelier {
    pub fn new(
        underlying_price: f64,
        strike_price: f64,
        volatility: f64,
        evaluation_date: Option<Date>,
        expiration_date: Date,
        option_type: TypeFlag,
    ) -> Self

    #[must_use]
    pub fn price(&self) -> f64
}

#[derive(derive_builder::Builder, Debug, Clone, Copy)]
pub struct ModifiedBachelier {
    pub underlying_price: f64,
    pub strike_price: f64,
    pub volatility: f64,
    pub risk_free_rate: f64,
    pub dividend_yield: f64,
    pub evaluation_date: Option<Date>,
    pub expiration_date: Date,
    pub option_type: TypeFlag,
}

impl ModifiedBachelier {
    pub const fn new(
        underlying_price: f64,
        strike_price: f64,
        volatility: f64,
        risk_free_rate: f64,
        dividend_yield: f64,
        evaluation_date: Option<Date>,
        expiration_date: Date,
        option_type: TypeFlag,
    ) -> Self

    #[must_use]
    pub fn price(&self) -> f64
}

Import

use RustQuant::instruments::{Bachelier, ModifiedBachelier, TypeFlag};

I/O Contract

Inputs

Name Type Required Description
underlying_price f64 Yes Current price of the underlying asset (S)
strike_price f64 Yes Option strike price (K)
volatility f64 Yes Absolute (dollar) volatility (v)
risk_free_rate f64 ModifiedBachelier only Risk-free interest rate (r)
dividend_yield f64 ModifiedBachelier only Continuous dividend yield
evaluation_date Option<Date> No Valuation date; defaults to today
expiration_date Date Yes Option expiration date
option_type TypeFlag Yes Call or Put

Outputs

Name Type Description
price f64 The Bachelier (or Modified Bachelier) option price

Usage Examples

use RustQuant::instruments::{Bachelier, ModifiedBachelier, TypeFlag};
use RustQuant::time::today;
use time::Duration;

// Standard Bachelier (no discounting)
let bach = Bachelier::new(
    100.0,
    100.0,
    0.2,
    None,
    today() + Duration::days(365),
    TypeFlag::Call,
);
let price = bach.price();

// Modified Bachelier (with discounting)
let mod_bach = ModifiedBachelier::new(
    100.0,
    100.0,
    0.2,
    0.05,   // risk_free_rate
    0.0,    // dividend_yield
    None,
    today() + Duration::days(365),
    TypeFlag::Call,
);
let mod_price = mod_bach.price();

Related Pages

Page Connections

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