From e688c3150fddd391124e8e3861f844af22014b59 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Tue, 6 Feb 2024 07:27:45 -0800 Subject: [PATCH] Add base backtest filter class --- backtesting/filter/backtest_filter.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 backtesting/filter/backtest_filter.py diff --git a/backtesting/filter/backtest_filter.py b/backtesting/filter/backtest_filter.py new file mode 100644 index 0000000..15fc9eb --- /dev/null +++ b/backtesting/filter/backtest_filter.py @@ -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] \ No newline at end of file