Skip to content

Commit

Permalink
Merge branch 'main' into refactor-get-profit-range
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaveiga authored Jan 23, 2025
2 parents 13ae03a + 00f5628 commit 1fa9168
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

## 1.4.1 (2025-01-04)
## 1.4.1 (2025-01-23)

- Removed a small bug in `create_price_seq` in support.py
- Improved the algorithm in `get_profit_range` in support.py, then renamed to `_get_profit_range`
Expand Down
13 changes: 7 additions & 6 deletions optionlab/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import numpy as np
from numpy import abs, round, arange, sum, exp

from numpy.lib.scimath import log, sqrt
from scipy import stats

Expand All @@ -27,9 +28,9 @@ def get_pl_profile(
x: float,
val: float,
n: int,
s: np.ndarray,
s: ndarray,
commission: float = 0.0,
) -> tuple[np.ndarray, float]:
) -> tuple[ndarray, float]:
"""
Returns the profit/loss profile and cost of an options trade at expiration.
Expand Down Expand Up @@ -73,8 +74,8 @@ def get_pl_profile(


def get_pl_profile_stock(
s0: float, action: Action, n: int, s: np.ndarray, commission: float = 0.0
) -> tuple[np.ndarray, float]:
s0: float, action: Action, n: int, s: ndarray, commission: float = 0.0
) -> tuple[ndarray, float]:
"""
Returns the profit/loss profile and cost of a stock position.
Expand Down Expand Up @@ -116,7 +117,7 @@ def get_pl_profile_bs(
target_to_maturity_years: float,
volatility: float,
n: int,
s: np.ndarray,
s: ndarray,
y: float = 0.0,
commission: float = 0.0,
) -> tuple[FloatOrNdarray, float]:
Expand Down Expand Up @@ -175,7 +176,7 @@ def get_pl_profile_bs(


@lru_cache
def create_price_seq(min_price: float, max_price: float) -> np.ndarray:
def create_price_seq(min_price: float, max_price: float) -> ndarray:
"""
Generates a sequence of stock prices from a minimum to a maximum price with
increment $0.01.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "optionlab"
version = "1.4.1"
description = "Python library for evaluating options trading strategies"

authors = ["Roberto Gomes, PhD <[email protected]>"]
readme = "README.md"

Expand Down

0 comments on commit 1fa9168

Please sign in to comment.