diff --git a/run_backtest.py b/run_backtest.py index 62af2df..87e196c 100644 --- a/run_backtest.py +++ b/run_backtest.py @@ -40,10 +40,7 @@ def create_strategies(entry_time: str): ) return call_spread_strat, put_spread_strat -def run_backtest(): - # TODO: Start date = yesterday. - start_date = datetime(2024, 1, 1) - end_date = datetime.now() +def run_backtest(start_date: datetime, end_date: datetime): for entry_time in entry_times(): call_spread_strategy, put_spread_strategy = create_strategies(entry_time) backtest_results = backtest_iron_condor( @@ -54,9 +51,12 @@ def run_backtest(): end_date ) # TODO: Think of a better way to handle this. - backtest_results.drop('Cumulative Profit', axis=1, inplace=True) + backtest_results.drop('Cumulative Profit', axis = 1, inplace = True) print(backtest_results) insert(backtest_results) if __name__ == '__main__': - run_backtest() \ No newline at end of file + # TODO: Update backtest to eliminate the need for setting this to midnight. + end_date = datetime.now().replace(hour = 0, minute = 0, second = 0, microsecond = 0) + start_date = end_date - timedelta(days = 1) + run_backtest(start_date, end_date) \ No newline at end of file