Skip to content

Commit

Permalink
Better handling of way OTM strikes
Browse files Browse the repository at this point in the history
  • Loading branch information
brndnmtthws committed Jan 19, 2024
1 parent e668c06 commit 62ee7d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion thetagang/portfolio_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,10 @@ def nearest_strikes(strikes):
return strikes[:chain_strikes]

strikes = nearest_strikes(strikes)
if len(strikes) < 1:
raise RuntimeError(
f"No valid contract strikes found for {main_contract.symbol}. Continuing anyway..."
)
console.print(
f"Scanning between strikes {strikes[0]} and {strikes[-1]},"
f" from expirations {expirations[0]} to {expirations[-1]}"
Expand Down Expand Up @@ -1595,7 +1599,7 @@ def filter_remaining_tickers(tickers, delta_ord_desc):
# because of this, we'll allow rolling to a less-than-optimal
# strike, provided it's still a credit
tickers = filter_remaining_tickers(delta_reject_tickers, False)
if len(tickers) == 0:
if len(tickers) < 1:
# if there are _still_ no tickers remaining, there's nothing
# more we can do
raise RuntimeError(
Expand Down

0 comments on commit 62ee7d5

Please sign in to comment.