pub struct BsmState { /* private fields */ }Expand description
Mutable European option under BSM (spot / vol / time / strike updates).
Fallible constructor is BsmState::new → FinanceResult (Result-only naming).
Implementations§
Source§impl BsmState
impl BsmState
Sourcepub fn new(params: BsmParams, option_type: OptionType) -> FinanceResult<Self>
pub fn new(params: BsmParams, option_type: OptionType) -> FinanceResult<Self>
Validate and store contract + market snapshot.
pub fn params(&self) -> BsmParams
pub fn option_type(&self) -> OptionType
Sourcepub fn set_spot(&mut self, spot: f64) -> FinanceResult<()>
pub fn set_spot(&mut self, spot: f64) -> FinanceResult<()>
Underlier mark moved (most common live update).
Sourcepub fn set_vol(&mut self, vol: f64) -> FinanceResult<()>
pub fn set_vol(&mut self, vol: f64) -> FinanceResult<()>
Set model / implied vol directly (absolute annualized).
Sourcepub fn set_time_years(&mut self, time_years: f64) -> FinanceResult<()>
pub fn set_time_years(&mut self, time_years: f64) -> FinanceResult<()>
Clock / expiry decay — pass remaining time in years.
Sourcepub fn set_strike(&mut self, strike: f64) -> FinanceResult<()>
pub fn set_strike(&mut self, strike: f64) -> FinanceResult<()>
Rarely changes live; included for completeness (e.g. corporate action resstrike).
pub fn set_rate(&mut self, rate: f64) -> FinanceResult<()>
pub fn set_dividend_yield(&mut self, dividend_yield: f64) -> FinanceResult<()>
Sourcepub fn set_vol_from_price(&mut self, market_price: f64) -> FinanceResult<f64>
pub fn set_vol_from_price(&mut self, market_price: f64) -> FinanceResult<f64>
Invert market premium into IV and store it (trading: mark to mid).
Sourcepub fn price(&self) -> FinanceResult<f64>
pub fn price(&self) -> FinanceResult<f64>
Model price at current params.
Sourcepub fn greeks(&self) -> FinanceResult<BsmGreeks>
pub fn greeks(&self) -> FinanceResult<BsmGreeks>
Model Greeks at current params.
Sourcepub fn cross_greeks(&self) -> FinanceResult<BsmCrossGreeks>
pub fn cross_greeks(&self) -> FinanceResult<BsmCrossGreeks>
Cross Greeks (vanna, volga, charm) at current params.
Trait Implementations§
impl StructuralPartialEq for BsmState
Auto Trait Implementations§
impl Freeze for BsmState
impl RefUnwindSafe for BsmState
impl Send for BsmState
impl Sync for BsmState
impl Unpin for BsmState
impl UnsafeUnpin for BsmState
impl UnwindSafe for BsmState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more