pub mod chain;
pub mod greeks;
pub mod iv;
pub mod normal;
pub mod pricing;
pub mod surface;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum OptionKind {
Call,
Put,
}
impl OptionKind {
pub fn sign(self) -> f64 {
match self {
Self::Call => 1.0,
Self::Put => -1.0,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PricingModel {
BlackScholes,
Black76,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Greeks {
pub delta: f64,
pub gamma: f64,
pub vega: f64,
pub theta: f64,
pub rho: f64,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct OptionContract {
pub model: PricingModel,
pub underlying: f64,
pub strike: f64,
pub rate: f64,
pub carry: f64,
pub time_to_expiry: f64,
pub kind: OptionKind,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct OptionEvaluation {
pub contract: OptionContract,
pub volatility: f64,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct IvSolverConfig {
pub initial_guess: f64,
pub tolerance: f64,
pub max_iterations: usize,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ChainGreeksContext {
pub model: PricingModel,
pub reference_price: f64,
pub rate: f64,
pub carry: f64,
pub time_to_expiry: f64,
pub kind: OptionKind,
}