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 EuropeanVanillaOption new

From Leeroopedia


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

Overview

Concrete tool for defining European vanilla option contracts provided by the RustQuant instruments crate.

Description

The EuropeanVanillaOption struct represents a European-style option with three core parameters: strike price, expiry date, and type flag (call or put). It implements the Payoff trait, enabling it to compute terminal payoffs for both analytic and Monte Carlo pricing engines. A builder pattern via EuropeanVanillaOptionBuilder is also available via the derive_builder crate.

Usage

Import this struct when you need to create a European option contract for pricing. This is the first step in both the Analytic Option Pricing and Monte Carlo Option Pricing workflows.

Code Reference

Source Location

  • Repository: RustQuant
  • File: crates/RustQuant_instruments/src/options/vanilla.rs
  • Lines: L30-65

Signature

#[derive(Debug, Clone, Builder, Copy)]
pub struct EuropeanVanillaOption {
    pub strike: f64,
    pub expiry: Date,
    pub type_flag: TypeFlag,
}

impl EuropeanVanillaOption {
    pub fn new(strike: f64, expiry: Date, type_flag: TypeFlag) -> Self
}

Import

use RustQuant::instruments::EuropeanVanillaOption;
use RustQuant::instruments::TypeFlag;
use time::Date;

I/O Contract

Inputs

Name Type Required Description
strike f64 Yes The strike price of the option
expiry time::Date Yes The expiration date of the option
type_flag TypeFlag Yes Call or Put

Outputs

Name Type Description
return EuropeanVanillaOption Struct instance ready for pricing via AnalyticOptionPricer or MonteCarloPricer

Usage Examples

Direct Construction

use RustQuant::instruments::{EuropeanVanillaOption, TypeFlag};
use time::macros::date;

// Create a European call option
let call = EuropeanVanillaOption::new(
    100.0,                    // strike price
    date!(2025 - 12 - 31),   // expiry date
    TypeFlag::Call,           // call option
);

// Create a European put option
let put = EuropeanVanillaOption::new(
    100.0,
    date!(2025 - 12 - 31),
    TypeFlag::Put,
);

Builder Pattern

use RustQuant::instruments::{EuropeanVanillaOptionBuilder, TypeFlag};
use time::macros::date;

let option = EuropeanVanillaOptionBuilder::default()
    .strike(100.0)
    .expiry(date!(2025 - 12 - 31))
    .type_flag(TypeFlag::Call)
    .build()
    .unwrap();

Related Pages

Implements Principle

Requires Environment

Page Connections

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