Skip to main content

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:

  1. 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.
  2. Ability to set y-axis limits using a custom function that takes the combined payoff array and returns a tuple (y_min, y_max).
  3. 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:

  1. risk_free_rate: float, default: 4.00 Risk free rate in percentage

  2. 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.

  3. 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

  4. Each leg in op_list can 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


Download files

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

Source Distribution

superopstrat-0.1.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

superopstrat-0.1.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

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

Hashes for superopstrat-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e87a21e274ce5b96835742e195388df72c007eb198203e821b7a12e7b640798c
MD5 417d5a874019f455ac0428c868dbec79
BLAKE2b-256 a69f28f76853005d91553174ff2137b0124cef38963f3c581caf763210913434

See more details on using hashes here.

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

Hashes for superopstrat-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3bd53b43cee250b512e0a41273949a7f3e9c84a90b233aa5d51ac64c47e30573
MD5 cb9ad0969007be582ae7c01514680b5b
BLAKE2b-256 c1ebe23d2c4b11142f146cbaf06803aa1271819447365bc494f26aa5cbc1ebf4

See more details on using hashes here.

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