Skip to content

Commit

Permalink
typing improved
Browse files Browse the repository at this point in the history
  • Loading branch information
uberdeveloper committed Mar 23, 2023
1 parent 3328cfa commit 1a1c289
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/fastbt/options/payoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Contract(BaseModel):
margin required for selling one lot of this contract
"""

strike: Union[int, float]
strike: float
option: Opt
side: Side
premium: float = 0.0
Expand Down Expand Up @@ -128,7 +128,7 @@ class OptionPayoff(BaseModel):

spot: float = 0.0
lot_size: int = 1
sim_range: Union[int, float] = 5
sim_range: float = 5
margin_percentage: float = 0.2
_options: List[Contract] = PrivateAttr(default_factory=list)

Expand Down
4 changes: 2 additions & 2 deletions src/fastbt/options/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def get_expiry_by(

def get_expiry_by_days(
expiries: List[pendulum.DateTime], days: int, sort: bool = True
) -> pendulum.DateTime:
) -> Optional[pendulum.DateTime]:
"""
Get the nearest expiry from current date till the given number of days
expiries
Expand All @@ -160,7 +160,7 @@ def get_expiry_by_days(
target_date = today.add(days=days)
if expiries[-1] < target_date:
# return None if the target date is greater than last expiry
return
return None
for i, expiry in enumerate(expiries):
if expiry >= target_date:
return expiry
Expand Down

0 comments on commit 1a1c289

Please sign in to comment.