Query filters using datetime set to midnight regardless of what the caller provides as this is what is expected of the data

This commit is contained in:
moshferatu 2024-02-13 14:28:27 -08:00
parent 517e70b471
commit 788f238530

View File

@ -9,5 +9,6 @@ class BacktestFilter:
pass pass
def trade_allowed(self, date: datetime) -> bool: def trade_allowed(self, date: datetime) -> bool:
date = datetime.combine(date, datetime.min.time()) # Enforcing midnight.
filtered_dates = self.backtest_filter[self.backtest_filter['Date'] == date] filtered_dates = self.backtest_filter[self.backtest_filter['Date'] == date]
return filtered_dates.empty or filtered_dates['Trade Allowed'].values[0] return filtered_dates.empty or filtered_dates['Trade Allowed'].values[0]