Skip to main content
OIPD raises typed exceptions for calculation failures and CSV parsing. Some public validation paths also raise Python built-ins such as ValueError and TypeError, so production code should usually catch both OIPD-specific errors and ordinary input-validation errors.

Base exception for all OIPD errors.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.
When it is raised: Not raised directly by OIPD. All OIPD exceptions are subclasses, so catching OIPDError will also catch InvalidInputError and CalculationError.
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.
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 VolSurface that 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.fit called with failure_policy="raise" when a slice fails to calibrate.
When VolSurface.fit is called with failure_policy="skip_warn" (the default), individual expiry failures do not raise CalculationError — they are skipped and recorded in warning_diagnostics. Use failure_policy="raise" if you need strict failure propagation.
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_csv cannot parse.
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.

Example