Removing comments as backtest is now successful over all dates and entry times in 2018

This commit is contained in:
moshferatu 2024-02-01 06:14:00 -08:00
parent 527bca9682
commit 05288fc235

View File

@ -59,7 +59,7 @@ def get_spread_history_credit(historical_option_data: pd.DataFrame, option_strat
long_strike = short_strike + (option_strat.spread_width if option_strat.option_type == OptionType.CALL else -option_strat.spread_width) long_strike = short_strike + (option_strat.spread_width if option_strat.option_type == OptionType.CALL else -option_strat.spread_width)
# Sometimes the strike we're interested in doesn't exist. Find the nearest one that does. # Sometimes the strike we're interested in doesn't exist. Find the nearest one that does.
increment = 5.0 if option_strat.option_type == OptionType.CALL else -5.0 increment = 5.0 if option_strat.option_type == OptionType.CALL else -5.0
while opening_quotes_by_contract_type[(opening_quotes_by_contract_type['strike'] == long_strike)].empty: # TODO: Doesn't work for one day in 2018. while opening_quotes_by_contract_type[(opening_quotes_by_contract_type['strike'] == long_strike)].empty:
long_strike = long_strike + increment long_strike = long_strike + increment
logging.info('Long Strike: %s', long_strike) logging.info('Long Strike: %s', long_strike)
@ -82,7 +82,7 @@ def get_spread_history(historical_option_data: pd.DataFrame, option_strat: Delta
long_strike = short_strike + (option_strat.spread_width if option_strat.option_type == OptionType.CALL else -option_strat.spread_width) long_strike = short_strike + (option_strat.spread_width if option_strat.option_type == OptionType.CALL else -option_strat.spread_width)
# Sometimes the strike we're interested in doesn't exist. Find the nearest one that does. # Sometimes the strike we're interested in doesn't exist. Find the nearest one that does.
increment = 5.0 if option_strat.option_type == OptionType.CALL else -5.0 increment = 5.0 if option_strat.option_type == OptionType.CALL else -5.0
while opening_quotes[(opening_quotes['strike'] == long_strike)].empty: # TODO: Doesn't work for one day in 2018. while opening_quotes[(opening_quotes['strike'] == long_strike)].empty:
long_strike = long_strike + increment long_strike = long_strike + increment
logging.info('Long Strike: %s', long_strike) logging.info('Long Strike: %s', long_strike)