Move signal candle generation into separate function

This commit is contained in:
froggleston 2022-04-20 14:05:33 +01:00
parent 933054a51c
commit f92997d378

View File

@ -1079,12 +1079,17 @@ class Backtesting:
if self.backtest_signal_candle_export_enable and \
self.dataprovider.runmode == RunMode.BACKTEST:
self._generate_trade_signal_candles(preprocessed_tmp, results)
return min_date, max_date
def _generate_trade_signal_candles(self, preprocessed_df, bt_results):
signal_candles_only = {}
for pair in preprocessed_tmp.keys():
for pair in preprocessed_df.keys():
signal_candles_only_df = DataFrame()
pairdf = preprocessed_tmp[pair]
resdf = results['results']
pairdf = preprocessed_df[pair]
resdf = bt_results['results']
pairresults = resdf.loc[(resdf["pair"] == pair)]
if pairdf.shape[0] > 0:
@ -1097,8 +1102,6 @@ class Backtesting:
self.processed_dfs[self.strategy.get_strategy_name()] = signal_candles_only
return min_date, max_date
def _get_min_cached_backtest_date(self):
min_backtest_date = None
backtest_cache_age = self.config.get('backtest_cache', constants.BACKTEST_CACHE_DEFAULT)