pub enum PricingError {
NegativeSpot,
NegativeStrike,
NegativeTime,
NegativeVolatility,
IntrinsicOnly {
intrinsic: f64,
},
}Expand description
Error returned by pricing functions when input validation fails or the option is at a degenerate boundary.
§Variants
All variants indicate a precondition violation except IntrinsicOnly,
which signals a valid but degenerate edge case (T == 0).
§Examples
use regit_blackscholes::errors::PricingError;
let err = PricingError::NegativeSpot;
assert_eq!(format!("{err}"), "spot price must be non-negative");Variants§
NegativeSpot
Spot price S is negative.
NegativeStrike
Strike price K is negative.
NegativeTime
Time to expiry T is negative.
NegativeVolatility
Volatility sigma is negative.
IntrinsicOnly
Time to expiry is zero — the option value equals the discounted
intrinsic value. The intrinsic field carries that value so the
caller can use it without re-computing.
Trait Implementations§
Source§impl Clone for PricingError
impl Clone for PricingError
Source§fn clone(&self) -> PricingError
fn clone(&self) -> PricingError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PricingError
Source§impl Debug for PricingError
impl Debug for PricingError
Source§impl Display for PricingError
impl Display for PricingError
Source§impl Error for PricingError
impl Error for PricingError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for PricingError
impl PartialEq for PricingError
impl StructuralPartialEq for PricingError
Auto Trait Implementations§
impl Freeze for PricingError
impl RefUnwindSafe for PricingError
impl Send for PricingError
impl Sync for PricingError
impl Unpin for PricingError
impl UnsafeUnpin for PricingError
impl UnwindSafe for PricingError
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