Exceptions¶
Error types
These exceptions cover invalid prices, missing brackets, root-finding failures, and convergence breakdowns in the numerical helpers.
Catch these when you want to distinguish input validation failures from numerical solver failures.
Exception reference¶
The module members below separate validation errors from solver and convergence failures so callers can catch the right class at the boundary.
InvalidOptionPriceError ¶
Bases: ValueError
Raised when an input option price violates no-arbitrage bounds.
This error is raised by _validate_bounds (and therefore by
implied_vol_bs_result / implied_vol_bs) when the provided market
option price is inconsistent with tight no-arbitrage bounds for European options
under continuous rates and dividend yield.
Notes
The bounds used are:
- Call:
max(Fp - K*df, 0) <= C <= Fp - Put :
max(K*df - Fp, 0) <= P <= K*df
where df = exp(-r*tau) and Fp = S*exp(-q*tau) is the prepaid forward.
RootFindingError ¶
Bases: Exception
Base class for root-finding failures.
NoConvergenceError ¶
Bases: RootFindingError
Raised when the method fails to converge within max_iter.
NotBracketedError ¶
Bases: RootFindingError
Raised when a bracketing method is called without a valid sign change.
NoBracketError ¶
Bases: NotBracketedError
Raised by ensure_bracket when it cannot find a bracketing interval.
DerivativeTooSmallError ¶
Bases: RootFindingError
Raised when Newton's method cannot proceed due to tiny derivative.