ProbCurve represents the risk-neutral probability distribution implied by a single-expiry option chain. You construct one using ProbCurve.from_chain, which fits an SVI volatility curve internally and derives the PDF and CDF. You can then query probabilities, moments, and quantiles, export a DataFrame, or render a plot — all without managing the underlying volatility model yourself.
Constructors
ProbCurve.from_chain
The primary way to build a ProbCurve. Accepts a single-expiry option chain DataFrame and market inputs, fits an SVI smile, and derives the risk-neutral distribution.
Option chain DataFrame for a single expiry. Must contain an
expiry column and at least one supported price column (last_price, or bid/ask).Market inputs providing the risk-free rate, valuation date, and underlying price.
Optional mapping in the form
{"dataframe_column": "oipd_column"}. For example, {"type": "option_type"} means your DataFrame has a type column and OIPD should treat it as option_type. See Standard columns for the target names.Maximum age of option quotes in calendar days, relative to the valuation date. Rows older than this threshold are filtered out before fitting.
Policy for handling CDF monotonicity violations during materialization.
"warn" repairs the CDF and records a diagnostic warning; "raise" raises a CalculationError on material violations.ValueError if the chain contains multiple expiries. CalculationError if volatility calibration fails.
ProbCurve.from_arrays
Advanced constructor. Builds a ProbCurve directly from precomputed price, PDF, and CDF arrays. Use this when you have already computed the distribution elsewhere and want to use OIPD’s query and plotting API.
Fully resolved market snapshot for the slice. You can obtain one via
oipd.resolve_market(market_inputs).Slice metadata dictionary. May include keys like
expiry and time_to_expiry_years.Strike price grid. Must be aligned with
pdf_values and cdf_values.Probability density values aligned with
prices.Cumulative distribution values aligned with
prices.Methods
pdf(price)
pdf(price)
Evaluate the Probability Density Function at one or more price levels.
Price level or array of price levels to evaluate.
PDF value(s). Returns a scalar
float when price is a scalar, or an ndarray otherwise. Values outside the fitted domain return 0.0.ProbCurve is also callable: prob(price) is an alias for prob.pdf(price).prob_below(price)
prob_below(price)
prob_above(price)
prob_above(price)
prob_between(low, high)
prob_between(low, high)
mean()
mean()
Expected value of the asset price under the fitted PDF.
E[S], computed by numerical integration of
price × pdf over the domain.variance()
variance()
skew()
skew()
Skewness (third standardized moment) of the fitted PDF.
Skew = E[(S - μ)³] / σ³. Negative values indicate a fat left tail, which is typical for equity distributions.
kurtosis()
kurtosis()
Excess kurtosis (fourth standardized moment minus 3) of the fitted PDF.
Excess kurtosis = E[(S - μ)⁴] / σ⁴ - 3. Zero implies a normal distribution; positive values indicate fat tails.
quantile(q)
quantile(q)
density_results(domain, points, full_domain)
density_results(domain, points, full_domain)
Export the fitted distribution as a DataFrame for analysis or custom plotting.
Optional explicit export domain as
(min_price, max_price). When provided, the native distribution is resampled onto this range. Takes precedence over full_domain.Number of output rows when resampling to a compact or explicit domain. Ignored when
full_domain=True and no domain is specified.When
True and domain is not set, returns the full native distribution arrays without resampling.DataFrame with columns
price, pdf, and cdf.plot(kind, figsize, title, xlim, ylim, points, full_domain)
plot(kind, figsize, title, xlim, ylim, points, full_domain)
Render the risk-neutral probability distribution as a matplotlib figure.
Which distribution curve(s) to render.
Figure size as (width, height) in inches.
Custom title. Auto-generated from market metadata when omitted.
Optional explicit x-axis (price) limits.
Optional explicit y-axis limits.
Number of display points for plot resampling.
When
True and xlim is not set, plots across the full native probability domain instead of the compact default view domain.The rendered matplotlib figure.
Properties
The default price grid used for standard visualization. Accessing this property triggers lazy distribution materialization on first call.
Probability densities over the stored price grid, in decimal form.
Cumulative probabilities over the stored price grid, in decimal form.
Structured diagnostic events recorded during fitting and materialization. Inspect
.warning_diagnostics.events for details on data-quality issues, model-risk warnings, or CDF repairs.Immutable snapshot of the market inputs used during calibration, including the resolved underlying price, risk-free rate, and valuation date.
Metadata captured during estimation, including the expiry timestamp, time to expiry in years, diagnostics, and domain information.