Skip to content

Commit

Permalink
ensure PriceTS is an timeseries
Browse files Browse the repository at this point in the history
  • Loading branch information
shrektan committed Jan 29, 2023
1 parent f1932f5 commit c1a9113
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions delta_hedge.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ class PriceTS():
points: np.ndarray
prices: np.ndarray

def __post_init__(self) -> None:
if np.ndim(self.points) != 1 or np.ndim(self.prices) != 1:
raise ValueError("the dim of points and prices must be 1")
if np.shape(self.points) != np.shape(self.prices):
raise ValueError("points and prices must have the same length")

def __len__(self) -> int:
return len(self.points)


def price_ts(p0: float, er: float, evol: float,
days: int, times_per_day: int) -> PriceTS:
Expand Down

0 comments on commit c1a9113

Please sign in to comment.