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 Exotic Option Constructors

From Leeroopedia


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

Overview

Concrete tools for defining exotic option contracts (Asian, Power, Barrier) provided by the RustQuant instruments crate.

Description

RustQuant provides several exotic option structs, each implementing the Payoff trait. All exotic options use OptionContract as a base configuration, which is built using the OptionContractBuilder pattern. Each exotic option type implements its specific payoff logic.

Usage

Import the exotic option struct, build an OptionContract specifying type_flag and exercise_flag, then construct the exotic option. Price via the MonteCarloPricer trait.

Code Reference

Source Location

  • Repository: RustQuant
  • File: crates/RustQuant_instruments/src/options/asian.rs (L30-43)
  • File: crates/RustQuant_instruments/src/options/power.rs (L118-157)
  • File: crates/RustQuant_instruments/src/options/option_contract.rs (L14-29)

Signature

// Option contract base (used by all exotic options)
#[derive(Debug, Clone, Builder)]
pub struct OptionContract {
    pub type_flag: TypeFlag,
    pub exercise_flag: ExerciseFlag,
    pub strike_flag: Option<StrikeFlag>,
}

// Asian option
pub struct AsianOption {
    pub contract: OptionContract,
    pub averaging_method: AveragingMethod,  // ArithmeticDiscrete or GeometricDiscrete
    pub strike: Option<f64>,
}
impl AsianOption {
    pub fn new(
        contract: OptionContract,
        averaging_method: AveragingMethod,
        strike: Option<f64>,
    ) -> Self
}

// Power option
pub struct PowerOption {
    pub contract: OptionContract,
    pub strike: f64,
    pub power: f64,
}
impl PowerOption {
    pub fn new(contract: OptionContract, strike: f64, power: f64) -> Self
}

Import

use RustQuant::instruments::{
    AsianOption, PowerOption, OptionContractBuilder,
    TypeFlag, ExerciseFlag, StrikeFlag, AveragingMethod,
};

I/O Contract

Inputs

Name Type Required Description
contract OptionContract Yes Base contract with type_flag, exercise_flag, strike_flag
averaging_method AveragingMethod Yes (Asian) ArithmeticDiscrete or GeometricDiscrete
strike Option<f64> Required for Fixed strike Asian Strike price
power f64 Yes (Power) Power exponent for the payoff

Outputs

Name Type Description
return Exotic option struct Struct implementing Payoff + MonteCarloPricer traits

Usage Examples

Asian Option (Arithmetic, Fixed Strike)

use RustQuant::instruments::{
    AsianOption, OptionContractBuilder, AveragingMethod,
    TypeFlag, ExerciseFlag, StrikeFlag,
};
use time::macros::date;

let contract = OptionContractBuilder::default()
    .type_flag(TypeFlag::Call)
    .exercise_flag(ExerciseFlag::European { expiry: date!(2025 - 12 - 31) })
    .strike_flag(Some(StrikeFlag::Fixed))
    .build()
    .unwrap();

let asian = AsianOption::new(
    contract,
    AveragingMethod::ArithmeticDiscrete,
    Some(100.0),  // fixed strike
);

Power Option

use RustQuant::instruments::{
    PowerOption, OptionContractBuilder,
    TypeFlag, ExerciseFlag,
};
use time::macros::date;

let contract = OptionContractBuilder::default()
    .type_flag(TypeFlag::Call)
    .exercise_flag(ExerciseFlag::European { expiry: date!(2025 - 12 - 31) })
    .strike_flag(None)
    .build()
    .unwrap();

let power = PowerOption::new(contract, 100.0, 2.0); // power=2

Related Pages

Implements Principle

Requires Environment

Page Connections

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