Expand description
High-performance Black–Scholes–Merton primitives for pricing European vanilla options, computing Greeks, and implied volatility.
§Quick start
use quant_opts::{BlackScholes, MarketData, OptionStyle, OptionType, VanillaModel, VanillaOption};
// Define an option and market snapshot
let option = VanillaOption::new(OptionStyle::European, OptionType::Call, 100.0, 30.0 / 365.25);
let market = MarketData::new(105.0, 0.03, 0.01);
let sigma = 0.22;
// Static API
let price = BlackScholes::price(&option, &market, sigma).unwrap();
let greeks = BlackScholes::greeks(&option, &market, sigma).unwrap();
// Trait-based API
let model = BlackScholes::new(sigma);
let price_via_trait = model.price(&option, &market).unwrap();
assert!((price - price_via_trait).abs() < 1e-12);More runnable examples live under examples/:
cargo run --example pricing_and_greekscargo run --example implied_vol
Benchmark commands are documented in README.md and docs/BENCHMARKING.md.
Re-exports§
pub use core::MarketData;pub use core::OptionStyle;pub use core::OptionType;pub use core::VanillaOption;pub use models::VanillaModel;pub use models::black_scholes::BlackScholes;
Modules§
- core
- Core domain types for
quant-opts. - lets_
be_ rational - models
- Pricing models available in
quant-opts.