pub struct PriceBlackScholes { /* private fields */ }Expand description
Builder-backed container for computing undiscounted European option prices under the Black–Scholes model.
Construct instances with PriceBlackScholes::builder(). The builder performs
basic domain validation when you call .build(). Use .build_unchecked() to
skip validation when you know inputs are already valid.
Fields:
forward: forward price of the underlying (F). Must be finite.strike: strike price (K). Must be finite.volatility: volatility (σ). Must be finite andσ >= 0.expiry: time to expiry (T). Must be finite andT >= 0.is_call:trueto price a call option,falseto price a put option.
The calculate::<SpFn>() method performs the numerical evaluation and uses a
SpecialFn implementation for any special-function approximations required
by the numerical routines.
Implementations§
Source§impl PriceBlackScholes
impl PriceBlackScholes
Sourcepub const fn builder() -> PriceBlackScholesBuilder
pub const fn builder() -> PriceBlackScholesBuilder
Create an instance of PriceBlackScholes using the builder syntax
Source§impl PriceBlackScholes
impl PriceBlackScholes
Sourcepub fn calculate<SpFn: SpecialFn>(&self) -> f64
pub fn calculate<SpFn: SpecialFn>(&self) -> f64
Compute the undiscounted Black–Scholes option price for the stored inputs.
§Type parameter
SpFn: SpecialFn— implementation used for internal special-function evaluations. Use the crate’sDefaultSpecialFnfor the default behavior or provide a custom implementation to change numerical characteristics.
§Returns
The computed undiscounted European option price.
Auto Trait Implementations§
impl Freeze for PriceBlackScholes
impl RefUnwindSafe for PriceBlackScholes
impl Send for PriceBlackScholes
impl Sync for PriceBlackScholes
impl Unpin for PriceBlackScholes
impl UnsafeUnpin for PriceBlackScholes
impl UnwindSafe for PriceBlackScholes
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