# superOpStrat
This is a modification of the great [opstrat](https://github.com/hashabcd/opstrat) library by [Hash Abcd](https://github.com/hashabcd) 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](https://pip.pypa.io/en/stable/) to install opstrat.

```bash
pip install superOpStrat
```

Import the library as:
```python
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.
