Enhanced options payoff diagram charting based on opstrat library
Project description
superOpStrat
This is a modification of the great opstrat library by Hash Abcd to add the following features:
- Ability to plot option values using Black-Scholes model by specifying days to expiration (dte) and volatility for each option leg. This is useful for plotting option strategies with options of different expiries like Calendar Spreads.
- Ability to set y-axis limits using a custom function that takes the combined payoff array and returns a tuple (y_min, y_max).
- Fix for y-axis values being off by a factor of 100.
Python library for visualizing options.
Requirements
pandas, numpy, matplotlib, seaborn, yfinance
Installation
Use the package manager pip to install opstrat.
pip install superOpStrat
Import the library as:
import superOpStrat as op
Usage
See the original opstrat library for usage instructions.
The new parameters for multi_plotter are:
-
risk_free_rate: float, default: 4.00 Risk free rate in percentage -
default_volatility: float, default: 32.00 Default volatility in percentage used for all option legs that don't specify their own volatility. Only used when 'dte' is provided for options. -
y_limiter: callable, optional, default: None A function that takes the combined payoff array (y) and returns a tuple (y_min, y_max) for setting ylim. If provided, will be called to set the y-axis limits. If None, matplotlib auto-scales the y-axis. Example: lambda y: (-max(abs(y)), max(abs(y))) for symmetric limits -
Each leg in
op_listcan have the following additional keys:dte: int, optional Days to expiration. If provided for one option, must be provided for all. When provided, uses Black-Scholes model to plot daily option values instead of payoff diagrams.volatility: float, optional Implied volatility in percentage for this specific option leg. If not provided, uses the default_volatility parameter.
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 superopstrat-0.1.2.tar.gz.
File metadata
- Download URL: superopstrat-0.1.2.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e87a21e274ce5b96835742e195388df72c007eb198203e821b7a12e7b640798c
|
|
| MD5 |
417d5a874019f455ac0428c868dbec79
|
|
| BLAKE2b-256 |
a69f28f76853005d91553174ff2137b0124cef38963f3c581caf763210913434
|
File details
Details for the file superopstrat-0.1.2-py3-none-any.whl.
File metadata
- Download URL: superopstrat-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bd53b43cee250b512e0a41273949a7f3e9c84a90b233aa5d51ac64c47e30573
|
|
| MD5 |
cb9ad0969007be582ae7c01514680b5b
|
|
| BLAKE2b-256 |
c1ebe23d2c4b11142f146cbaf06803aa1271819447365bc494f26aa5cbc1ebf4
|