Skip to main content

Calculate max pain from open interest data

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openinterest-0.1.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openinterest-0.1.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file openinterest-0.1.2.tar.gz.

File metadata

  • Download URL: openinterest-0.1.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for openinterest-0.1.2.tar.gz
Algorithm Hash digest
SHA256 003cb63b76d8b40c8357a47d86c9ad85b9275ee1c594909a583611538757975e
MD5 c105e8a7dd4c7f7cf1005bd83cba28ac
BLAKE2b-256 1a5f56c736a2eb6f63bce94f9e2992c9f29710023e59d2f16a120389563515b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinterest-0.1.2.tar.gz:

Publisher: workflow.yml on charlesverge/openinterest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openinterest-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: openinterest-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for openinterest-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2e3ee2848d49f97849596f656220651fe0cf677595d0f6fc343dec56fd0dc11d
MD5 7b1ea9f799e45598394649a339c7c94c
BLAKE2b-256 246c7208c6e5daa23648542c700078a89bfa8247c0225441d699070caba2342f

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinterest-0.1.2-py3-none-any.whl:

Publisher: workflow.yml on charlesverge/openinterest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page