pub enum IvError {
NoSolution,
BelowIntrinsic {
intrinsic: f64,
},
MaxIterationsReached {
last_vol: f64,
residual: f64,
},
NearZeroVega,
BoundsExceeded {
vol: f64,
},
}Expand description
Error returned by implied volatility solvers when convergence fails or the market price is inconsistent with the model.
§Variants
Each variant carries diagnostic context so the caller can decide whether to retry with a different solver or report the failure.
§Examples
use regit_blackscholes::errors::IvError;
let err = IvError::NoSolution;
assert_eq!(format!("{err}"), "no implied volatility solution exists");Variants§
NoSolution
No implied volatility solution exists for the given market price.
BelowIntrinsic
Market price is below the intrinsic value — no valid vol can produce it.
MaxIterationsReached
Solver reached maximum iteration count without converging.
Fields
NearZeroVega
Vega is near zero — the solver cannot make progress because the price surface is flat with respect to volatility.
BoundsExceeded
The implied volatility solution exceeds the search bounds [1e-8, 100.0].
Trait Implementations§
impl Copy for IvError
Source§impl Error for IvError
impl Error for IvError
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()
impl StructuralPartialEq for IvError
Auto Trait Implementations§
impl Freeze for IvError
impl RefUnwindSafe for IvError
impl Send for IvError
impl Sync for IvError
impl Unpin for IvError
impl UnsafeUnpin for IvError
impl UnwindSafe for IvError
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