Skip to main content

Open Interest Max Pain Calculator

A Python package for calculating max pain from open interest data.

Installation

pip install openinterest

Usage

from openinterest import calculate_max_pain

# Example data
data = [
    {"expiration": "2024-03-22", "strike": 90, "type": "call", "open_interest": 100},
    {"expiration": "2024-03-15", "strike": 90, "type": "call", "open_interest": 100},
    {"expiration": "2024-03-15", "strike": 90, "type": "put", "open_interest": 50},
    {"expiration": "2024-03-15", "strike": 100, "type": "call", "open_interest": 200},
    {"expiration": "2024-03-15", "strike": 100, "type": "put", "open_interest": 150},
    {"expiration": "2024-03-15", "strike": 110, "type": "call", "open_interest": 50},
    {"expiration": "2024-03-15", "strike": 110, "type": "put", "open_interest": 200},
    {"expiration": "2024-03-15", "strike": 120, "type": "call", "open_interest": 20},
    {"expiration": "2024-03-15", "strike": 120, "type": "put", "open_interest": 300},
    {"expiration": "2024-03-15", "strike": 130, "type": "call", "open_interest": 10},
    {"expiration": "2024-03-15", "strike": 130, "type": "put", "open_interest": 400},
]
# Calculate max pain
max_pain_price, pain_values = calculate_max_pain(data)

print(f"Max pain price: {max_pain_price}")

Development

To set up the development environment:

git clone https://github.com/charlesverge/openinterest.git
cd openinterest
pip install -e .

Testing

Run the tests with:

pytest

License

MIT License

Metadata

Release files for openinterest 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openinterest 0.1.2
File Size Uploaded Provenance
openinterest-0.1.2.tar.gz 3.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openinterest 0.1.2
File Interpreter ABI Platform
openinterest-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / openinterest-0.1.2.tar.gz

Download URL openinterest-0.1.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
003cb63b76d8b40c8357a47d86c9ad85b9275ee1c594909a583611538757975e
BLAKE2b-256 checksum
How to use checksums
1a5f56c736a2eb6f63bce94f9e2992c9f29710023e59d2f16a120389563515b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2025.

Transparency log

Release files / openinterest-0.1.2-py3-none-any.whl

Download URL openinterest-0.1.2-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e3ee2848d49f97849596f656220651fe0cf677595d0f6fc343dec56fd0dc11d
BLAKE2b-256 checksum
How to use checksums
246c7208c6e5daa23648542c700078a89bfa8247c0225441d699070caba2342f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2025.

Transparency log

Security for openinterest 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openinterest-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page