VanillaModel

Trait VanillaModel 

Source
pub trait VanillaModel {
    // Required methods
    fn price(
        &self,
        opt: &VanillaOption,
        mkt: &MarketData,
    ) -> Result<f64, String>;
    fn greeks(
        &self,
        opt: &VanillaOption,
        mkt: &MarketData,
    ) -> Result<Greeks, String>;
    fn implied_vol(
        &self,
        target_price: f64,
        opt: &VanillaOption,
        mkt: &MarketData,
    ) -> Result<f64, String>;
}
Expand description

Core abstraction for a model that can price vanilla options.

This trait is intentionally conservative in scope for now:

  • it operates only on the core domain types,
  • it does not prescribe any particular volatility parametrisation,
  • it exposes fallible operations via Result so callers can handle invalid inputs explicitly.

Required Methods§

Source

fn price(&self, opt: &VanillaOption, mkt: &MarketData) -> Result<f64, String>

Price a vanilla option under this model.

Source

fn greeks( &self, opt: &VanillaOption, mkt: &MarketData, ) -> Result<Greeks, String>

Compute a set of Greeks for a vanilla option.

Source

fn implied_vol( &self, target_price: f64, opt: &VanillaOption, mkt: &MarketData, ) -> Result<f64, String>

Compute implied volatility such that the model price matches target_price.

Implementors§