Metadata-Version: 2.4
Name: oipd
Version: 1.0.1
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>
License: Apache License 2.0
Project-URL: Homepage, https://github.com/tyrneh/options-implied-probability
Project-URL: Bug Tracker, https://github.com/tyrneh/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>=1.26.0
Requires-Dist: pandas>=2.1.0
Requires-Dist: scipy>=1.11.0
Requires-Dist: matplotlib>=3.8.0
Requires-Dist: matplotlib-label-lines>=0.6.0
Requires-Dist: traitlets>=5.12.0
Requires-Dist: yfinance>=0.2.60
Provides-Extra: minimal
Requires-Dist: numpy>=1.26.0; extra == "minimal"
Requires-Dist: pandas>=2.1.0; extra == "minimal"
Requires-Dist: scipy>=1.11.0; extra == "minimal"
Requires-Dist: matplotlib>=3.8.0; extra == "minimal"
Requires-Dist: matplotlib-label-lines>=0.6.0; extra == "minimal"
Requires-Dist: traitlets>=5.12.0; extra == "minimal"
Provides-Extra: dev
Requires-Dist: black>=24.3.0; extra == "dev"
Requires-Dist: isort>=5.13.0; extra == "dev"
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: mypy>=1.8.0; extra == "dev"
Requires-Dist: build>=1.0.0; extra == "dev"
Dynamic: license-file

![OIPD logo](https://github.com/tyrneh/options-implied-probability/blob/main/.meta/images/OIPD%20Logo.png)

[![PyPI - Python Version](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/tyrneh/options-implied-probability/blob/main/examples/OIPD_colab_demo.ipynb)
[![Chat on Discord](https://img.shields.io/badge/chat-on%20Discord-brightgreen?logo=discord&logoColor=white)](https://discord.gg/pWVrmQWk)
[![PyPI 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 reveals the market's expectations about the probability of an asset reaching different prices at a future date, based on information contained in options data. 

While markets don't predict the future with certainty, under the efficient market hypothesis, these collective expectations represent the best available estimate of what might happen.

Traditionally, extracting these “risk-neutral densities” required institutional knowledge and resources, limited to specialist quant-desks. OIPD makes this capability accessible to everyone — delivering an institutional-grade tool in a simple, production-ready Python package.

<p align="center" style="margin-top: 80px;">
  <img src="https://github.com/tyrneh/options-implied-probability/blob/main/example.png" alt="example" style="width:100%; max-width:1200px; height:auto; display:block; margin-top:50px;" />
</p>



# Quick start

#### Installation
```bash
pip install oipd
```

#### Usage

![OIPDwalkthrough](https://github.com/user-attachments/assets/2da5506d-a720-4f93-820b-23b368d074bb)

```python
from oipd import RND, MarketInputs
from datetime import date

# 1 ─ point to a ticker and provide market info
market = MarketInputs(
    valuation_date=date.today(),      # the "as-of" date for the analysis
    expiry_date=date(2025, 12, 19),   # option expiry date you care about
    risk_free_rate=0.04,              # annualized risk-free rate
)

# 2 - run estimator, auto fetching data from Yahoo Finance
est = RND.from_ticker("AAPL", market)   

# 3 ─ access results and plots
est.prob_at_or_above(120)               # P(price >= $120)
est.prob_below(100)                     # P(price < $100)
est.plot()                              # plot probability and cumulative distribution functions 
```

OIPD also supports manual CSV or DataFrame uploads. See [`TECHNICAL_README.md`](TECHNICAL_README.md) for more details.

See [more examples](examples/example.ipynb) with provided options data. 


# Use cases

**Event-driven strategies: assess market's belief about the likelihood of mergers**

- Nippon Steel offered to acquire US Steel for $55 per share; in early 2025, US Steel was trading at $30 per share. Using OIPD, you find that the market believed US Steel had a ~20% probability of acquisition (price >= $55 by end of year)
- If you believe that political backlash was overstated and the acquisition was likely to be approved, then you can quantify a trade's expected payoff. Compare your subjective belief with the market-priced probability to determine expected value of buying stock or calls

**Risk management: compute forward-looking Value-at-Risk**

- A 99% 12-month VaR of 3% is (i) backward-looking and (ii) assumes a parametric distribution, often unrealistic assumptions especially before catalysts
- Ahead of earnings season, pull option-implied distributions for holdings. The forward-looking, non-parametric distribution point to a 6% portfolio-blended VaR

**Treasury management: decide the next commodity hedge tranche**

- As an airline, a portion of next year’s jet fuel demand is hedged; the rest floats. Use OIPD to estimate the probability of breaching your budget and the expected overspend (earnings-at-risk) on the unhedged slice
- If OIPD shows higher price risk, add a small 5–10% hedged tranche using to pull P(breach)/EaR back within board guardrails

# Community

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

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