Add base backtest filter class

This commit is contained in:
moshferatu 2024-02-06 07:27:45 -08:00
parent 31c60d10e3
commit e688c3150f

View File

@ -0,0 +1,13 @@
from datetime import datetime
from pandas import DataFrame
class BacktestFilter:
backtest_filter: DataFrame = None
def filter(self) -> DataFrame:
pass
def trade_allowed(self, date: datetime) -> bool:
filtered_dates = self.backtest_filter[self.backtest_filter['Date'] == date]
return filtered_dates.empty or filtered_dates['Trade Allowed'].values[0]