Dont persist Backtesting to avoid memory leak

This commit is contained in:
Matthias 2023-06-08 20:13:28 +02:00
parent 675a97c1cb
commit 6b736c49d4

View File

@ -61,7 +61,7 @@ class LookaheadAnalysis:
return timestamp return timestamp
@staticmethod @staticmethod
def get_result(backtesting, processed: pd.DataFrame): def get_result(backtesting: Backtesting, processed: pd.DataFrame):
min_date, max_date = get_timerange(processed) min_date, max_date = get_timerange(processed)
result = backtesting.backtest( result = backtesting.backtest(
@ -143,15 +143,15 @@ class LookaheadAnalysis:
str(self.dt_to_timestamp(varholder.to_dt))) str(self.dt_to_timestamp(varholder.to_dt)))
prepare_data_config['exchange']['pair_whitelist'] = pairs_to_load prepare_data_config['exchange']['pair_whitelist'] = pairs_to_load
self.backtesting = Backtesting(prepare_data_config) backtesting = Backtesting(prepare_data_config)
self.backtesting._set_strategy(self.backtesting.strategylist[0]) backtesting._set_strategy(backtesting.strategylist[0])
varholder.data, varholder.timerange = self.backtesting.load_bt_data() varholder.data, varholder.timerange = backtesting.load_bt_data()
self.backtesting.load_bt_data_detail() backtesting.load_bt_data_detail()
varholder.timeframe = self.backtesting.timeframe varholder.timeframe = backtesting.timeframe
varholder.indicators = self.backtesting.strategy.advise_all_indicators(varholder.data) varholder.indicators = backtesting.strategy.advise_all_indicators(varholder.data)
varholder.result = self.get_result(self.backtesting, varholder.indicators) varholder.result = self.get_result(backtesting, varholder.indicators)
def fill_full_varholder(self): def fill_full_varholder(self):
self.full_varHolder = VarHolder() self.full_varHolder = VarHolder()