Run example backtest for the previous day
This commit is contained in:
parent
abe318db56
commit
e3cae9d8a7
@ -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()
|
||||
# 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)
|
Loading…
Reference in New Issue
Block a user