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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
003cb63b76d8b40c8357a47d86c9ad85b9275ee1c594909a583611538757975e
|
|
| MD5 |
c105e8a7dd4c7f7cf1005bd83cba28ac
|
|
| BLAKE2b-256 |
1a5f56c736a2eb6f63bce94f9e2992c9f29710023e59d2f16a120389563515b1
|
Provenance
The following attestation bundles were made for openinterest-0.1.2.tar.gz:
Publisher:
workflow.yml on charlesverge/openinterest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openinterest-0.1.2.tar.gz -
Subject digest:
003cb63b76d8b40c8357a47d86c9ad85b9275ee1c594909a583611538757975e - Sigstore transparency entry: 201572963
- Sigstore integration time:
-
Permalink:
charlesverge/openinterest@fb27c1563cdcaa98726f55c2c9a6dd9671de33b1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/charlesverge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@fb27c1563cdcaa98726f55c2c9a6dd9671de33b1 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e3ee2848d49f97849596f656220651fe0cf677595d0f6fc343dec56fd0dc11d
|
|
| MD5 |
7b1ea9f799e45598394649a339c7c94c
|
|
| BLAKE2b-256 |
246c7208c6e5daa23648542c700078a89bfa8247c0225441d699070caba2342f
|
Provenance
The following attestation bundles were made for openinterest-0.1.2-py3-none-any.whl:
Publisher:
workflow.yml on charlesverge/openinterest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openinterest-0.1.2-py3-none-any.whl -
Subject digest:
2e3ee2848d49f97849596f656220651fe0cf677595d0f6fc343dec56fd0dc11d - Sigstore transparency entry: 201572966
- Sigstore integration time:
-
Permalink:
charlesverge/openinterest@fb27c1563cdcaa98726f55c2c9a6dd9671de33b1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/charlesverge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@fb27c1563cdcaa98726f55c2c9a6dd9671de33b1 -
Trigger Event:
push
-
Statement type: