VolCurve, VolSurface, ProbCurve, and ProbSurface — records structured warning events during fitting and evaluation. Rather than hiding problems silently or flooding you with unstructured text, OIPD emits one concise Python warning per broad category and stores detailed, queryable events on .warning_diagnostics. The guide below explains the four warning categories, shows how to inspect them, and covers the cdf_violation_policy option for strict CDF enforcement.
Warning categories
Import the warning classes fromoipd.warnings to filter or catch specific warning types in your code:
DataQualityWarning
DataQualityWarning
DataQualityWarning fires when OIPD detects issues with the observed input data itself, before any model fitting occurs.Event typesstale_quote_filter— rows were dropped because the quote age exceededmax_staleness_days(default: 3 days). The event details record the count of filtered rows and the configured staleness threshold.price_fallback—bidoraskvalues were missing for some rows, so OIPD filled the mid price withlast_priceinstead. The event details record the count of filled rows.
ModelRiskWarning
ModelRiskWarning
ModelRiskWarning fires when the fitted model itself raises economic concerns.Event typesbutterfly_arbitrage— the SVI calibration produced a negative butterfly spread (min_g < 0), which indicates potential arbitrage in the fitted smile. The event details include themin_gvalue and the threshold used.cdf_repair— the derived risk-neutral CDF was not monotonically non-decreasing and was repaired. There are two severity levels:"warning"— the non-monotonicity was material: larger than the repair tolerance but within an acceptable total-variation budget."severe"— the non-monotonicity was severe: the total negative variation exceeded the budget, meaning the CDF repair may significantly alter the distribution.
NumericalWarning
NumericalWarning
NumericalWarning fires when numerical issues arise during computation, such as near-singular matrices or convergence degradation.When it matters: this category typically indicates that a particular expiry had very sparse or low-quality quotes, causing the optimizer to converge to a fragile solution. Inspect the event details for the affected expiry and consider excluding it or sourcing better data.WorkflowWarning
WorkflowWarning
WorkflowWarning fires when OIPD’s best-effort fitting skips one or more expiries instead of raising an error.Event typeskipped_expiry— an expiry was skipped duringVolSurface.fitorProbSurface.from_chainbecause it failed to calibrate. The event details include the expiry date, the exception type, and a short reason message.
failure_policy="raise" to surface these failures immediately rather than continuing.Diagnostics
Every fitted object exposes a.warning_diagnostics property that returns a WarningDiagnostics instance. Use .summary for aggregate counts and .events for the full structured event list.
summary object has the following fields:
| Field | Type | Description |
|---|---|---|
total_events | int | Total number of warning events |
by_category | Mapping[str, int] | Count per broad category |
by_event_type | Mapping[str, int] | Count per specific event type |
by_severity | Mapping[str, int] | Count per severity level |
worst_severity | str | None | Highest severity seen ("info", "warning", or "severe") |
WarningEvent in .events has category, event_type, severity, scope, message, and details fields.
Strict CDF mode
By default, OIPD repairs minor CDF monotonicity violations and records aModelRiskWarning. Use cdf_violation_policy="raise" when you want any material violation to propagate immediately as an error instead of being silently repaired.
ProbSurface.from_chain and the ProbSurface constructor.