ValueError and TypeError, so production code should usually catch both OIPD-specific errors and ordinary input-validation errors.
OIPDError
OIPDError
Base exception for all OIPD errors.When it is raised: Not raised directly by OIPD. All OIPD exceptions are subclasses, so catching
OIPDError is the root of the OIPD exception hierarchy. Catch it when you want a single handler for any library-level failure, regardless of its specific cause.OIPDError will also catch InvalidInputError and CalculationError.InvalidInputError
InvalidInputError
Raised by some lower-level probability and plotting paths when inputs are invalid.
InvalidInputError is part of the OIPD exception hierarchy, but not every public validation path uses it. Many common checks in data loading and .fit(...) methods raise ValueError or TypeError instead.Common public input failures include:- Missing columns or unsupported quote shapes in data readers:
ValueError. - Non-positive strikes or negative prices after cleaning:
ValueError. - Invalid single-expiry data passed to
VolCurve.fit:ValueError.
CalculationError
CalculationError
Raised when calibration fails or a numerical computation cannot complete.
CalculationError indicates that OIPD received valid inputs but was unable to complete the calculation. Common triggers include:- SVI calibration returning no fitted curve (e.g., insufficient liquid strikes after staleness filtering).
- A
VolSurfacethat has fewer than two unique expiries after horizon or staleness filtering. - An expiry that is on or before the valuation date (zero or negative time to expiry).
VolSurface.fitcalled withfailure_policy="raise"when a slice fails to calibrate.
CSVReadError
CSVReadError
Raised when CSV loading fails.
CSVReadError is raised by sources.from_csv and CSVReader.read when the CSV file exists but cannot be parsed. Note that CSVReadError does not inherit from OIPDError — it is a standalone exception defined in oipd.data_access.readers.Common triggers include:- A file encoding that cannot be decoded (e.g., a binary file passed as a CSV path).
- A corrupt or malformed CSV that
pandas.read_csvcannot parse.
NotImplementedError
NotImplementedError
Raised by
sources.list_expiry_dates when the vendor does not support expiry listing.This is Python’s built-in NotImplementedError, not an OIPD exception. It is raised when you call sources.list_expiry_dates with a vendor that has not implemented the expiry-listing capability.