pub enum Model {
BlackScholes(OptionParams<f64>),
Black76(Black76Params),
Bachelier(BachelierParams),
Displaced(DisplacedParams),
}Expand description
Dynamic dispatch across the four pricing models.
Wraps OptionParams<f64>, Black76Params, BachelierParams, and
DisplacedParams in a single enum for runtime model selection.
§Examples
use regit_blackscholes::types::{Model, OptionParams, OptionType, Pricing};
use regit_blackscholes::models::black76::Black76Params;
let bs = Model::BlackScholes(OptionParams {
option_type: OptionType::Call,
spot: 100.0_f64, strike: 100.0_f64,
rate: 0.05_f64, div_yield: 0.02_f64,
vol: 0.20_f64, time: 1.0_f64,
});
let price = bs.price().unwrap();
assert!(price > 0.0_f64);Variants§
BlackScholes(OptionParams<f64>)
Black-Scholes-Merton (Merton 1973) — vanilla European, continuous dividend.
Black76(Black76Params)
Black-76 (Black 1976) — options on futures/forwards.
Bachelier(BachelierParams)
Bachelier / Normal model (Bachelier 1900) — for rates near/below zero.
Displaced(DisplacedParams)
Displaced log-normal (Rubinstein 1983) — shifted Black-76.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnsafeUnpin for Model
impl UnwindSafe for Model
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more