Metadata-Version: 2.4
Name: oipd
Version: 2.0.4
Summary: Generate probability distributions on the future price of publicly traded securities using options data
Author-email: Henry Tian <tyrneh@gmail.com>, Jannic Holzer <jannic.holzer@gmail.com>, Chun Hei Hung <chunhei1848@gmail.com>, Jaewon La <jaewonla0225@gmail.com>
License: Apache License 2.0
Project-URL: Homepage, https://github.com/Open-Lemma/options-implied-probability
Project-URL: Bug Tracker, https://github.com/Open-Lemma/options-implied-probability/issues
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.0.0
Requires-Dist: pandas>=2.2.2
Requires-Dist: scipy>=1.13.0
Requires-Dist: matplotlib>=3.9.0
Requires-Dist: matplotlib-label-lines>=0.6.0
Requires-Dist: plotly<6,>=5
Requires-Dist: traitlets>=5.12.0
Requires-Dist: yfinance>=0.2.60
Provides-Extra: minimal
Requires-Dist: numpy>=2.0.0; extra == "minimal"
Requires-Dist: pandas>=2.2.2; extra == "minimal"
Requires-Dist: scipy>=1.13.0; extra == "minimal"
Requires-Dist: matplotlib>=3.9.0; extra == "minimal"
Requires-Dist: matplotlib-label-lines>=0.6.0; extra == "minimal"
Requires-Dist: plotly<6,>=5; extra == "minimal"
Requires-Dist: traitlets>=5.12.0; extra == "minimal"
Provides-Extra: dev
Requires-Dist: black>=26.3.1; extra == "dev"
Requires-Dist: isort>=5.13.0; extra == "dev"
Requires-Dist: pytest<10,>=9.0.3; extra == "dev"
Requires-Dist: mypy>=1.8.0; extra == "dev"
Requires-Dist: build>=1.0.0; extra == "dev"
Provides-Extra: experiments
Requires-Dist: PyYAML>=6.0; extra == "experiments"
Requires-Dist: Pillow>=10.0.0; extra == "experiments"
Requires-Dist: pyarrow>=15.0.0; extra == "experiments"
Requires-Dist: databento>=0.55.0; extra == "experiments"
Dynamic: license-file

![OIPD: options-implied probability distribution](docs/images/readme/gme-probsurface-header.png)

[![Python versions](https://img.shields.io/pypi/pyversions/oipd?logo=python&logoColor=white)](https://pypi.org/project/oipd/)
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Open-Lemma/options-implied-probability/blob/main/OIPD_Demo.ipynb)
[![Discord](https://img.shields.io/badge/chat-on%20Discord-brightgreen?logo=discord&logoColor=white)](https://discord.gg/NHxWPGhhSQ)
[![Downloads](https://static.pepy.tech/personalized-badge/oipd?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/oipd)

## Overview

OIPD computes the probabilities of an asset's future price as implied by the options market.

It does this by taking listed options data, fitting an arbitrage-free implied volatility surface, and then transforming that fitted object into a probability distribution over future asset prices. In practice, that provides two core capabilities in one library:

- **Volatility modeling:** fit single-expiry smiles and multi-expiry volatility surfaces, and compute greeks. 
- **Probability extraction:** compute market-implied probability distributions, and distribution statistics. 

[**Read the docs**](https://docs.open-lemma.com) · [**Use the web interface**](https://open-lemma.com)

## Quick install

The standard install includes the built-in yfinance data connection.

```bash
pip install oipd
```

## One quick example

Fetch GameStop options across the next twelve months, fit a `VolSurface`, derive a `ProbSurface`, and plot the fan chart.

```python
import matplotlib.pyplot as plt

from oipd import MarketInputs, VolSurface, sources

ticker = "GME"
chain, snapshot = sources.fetch_chain(
    ticker,
    horizon="12m",  # fetch all listed expiries inside the next 12 months
)

market = MarketInputs(
    valuation_date=snapshot.asof,
    underlying_price=snapshot.underlying_price,
    risk_free_rate=0.04,
)

vol_surface = VolSurface().fit(chain, market)
surface = vol_surface.implied_distribution()

fig = surface.plot_fan()
plt.show()
```

![GME ProbSurface fan plot generated by OIPD](docs/images/readme/gme-probsurface-fan.png)

`surface.plot_fan()` visualizes the market-implied price distribution across fitted option expiries.

You can also take one expiry from the surface and query it as a `ProbCurve`.

```python
curve = surface.slice(surface.expiries[-1])  # take the last expiry

print(curve.prob_below(25))  # P(GME price < 25) at that expiry
print(curve.quantile(0.50))  # median implied price at that expiry

fig = curve.plot()
fig.axes[0].set_xlim(0, 100)
plt.show()
```

![GME ProbCurve slice generated from a ProbSurface](docs/images/readme/gme-probcurve-slice.png)

A surface slice returns a `ProbCurve`, so you can inspect one expiry as a standalone probability distribution.

## Example Notebooks

See [more examples](examples/) for demos.

# Community

Pull requests welcome! Reach out on GitHub issues to discuss design choices.

Join the [Discord community](https://discord.gg/NHxWPGhhSQ) to share ideas, discuss strategies, and get support. Message me with your feature requests, and let me know how you use this.

# Contributors

**Thanks to everyone who has contributed code:**

[![Contributors](https://contrib.rocks/image?repo=Open-Lemma/options-implied-probability)](https://github.com/Open-Lemma/options-implied-probability/graphs/contributors)

**And special thanks for support on theory, implementation, or advisory:**
- [NewMark Risk](https://newmarkrisk.com/)
- [integral-alpha](https://integral-alpha.com)
- [Vivek Rao](https://github.com/vivek-v-rao), Jannic H., Chun H. H., and Melanie C.
- and others who prefer to go unnamed
