Skip to main content
OIPD accepts options data from three sources: the built-in yfinance connection, a CSV file on disk, and an in-memory DataFrame. All three paths normalize data into the same standard column schema before you pass the result to VolCurve, VolSurface, ProbCurve, or ProbSurface. Choose the tab that matches your data source below.
The sources module wraps yfinance to download live options chains in one call. Use list_expiry_dates to browse available dates, then fetch_chain to download a chain or surface.List available expiry dates
from oipd import sources

expiries = sources.list_expiry_dates("AAPL")
# e.g. ["2026-05-15", "2026-06-19", "2026-09-18", ...]
print(expiries)
Download a single expiry
chain, snapshot = sources.fetch_chain("AAPL", expiries=expiries[1])
Download a multi-expiry surfacePass horizon instead of expiries to fetch all listed expiries within the window:
chain_surface, snapshot_surface = sources.fetch_chain(
    "AAPL",
    horizon="12m",   # "3m", "6m", "1y", etc.
)
You cannot pass both expiries and horizon — OIPD raises a ValueError if you do.Using the VendorSnapshotfetch_chain returns a (DataFrame, VendorSnapshot) tuple. The snapshot records the download context. Use its fields to populate MarketInputs:
FieldTypeDescription
.asofdatetimeTimestamp of the data pull
.underlying_pricefloat | NoneUnderlying spot price at download time
.vendorstrSource vendor, e.g. "yfinance"
from oipd import MarketInputs

market = MarketInputs(
    valuation_date=snapshot.asof,
    underlying_price=snapshot.underlying_price,
    risk_free_rate=0.04,
)
fetch_chain caches network responses for 15 minutes by default. Pass cache_enabled=False or cache_ttl_minutes=5 to change the caching behavior.

Standard columns

OIPD expects these target column names after any column_mapping is applied:
ColumnRequiredDescription
strikeYesStrike price
last_pricePrice column optionLast traded price
bidPrice column optionBid price; use with ask
askPrice column optionAsk price; use with bid
expiryFit-ready dataExpiry date (YYYY-MM-DD or datetime)
option_typeFit-ready data"C" / "P" after normalization
volumeRecommended with last_priceTraded volume; used as a fitting weight when available
last_trade_dateNoQuote timestamp used for staleness filtering