@@ -37,10 +37,12 @@ def __init__(self, config: dict[str, Any], strategy_obj: dict):
3737
3838 self .dict_recursive : dict [str , Any ] = dict ()
3939
40+ self .pair_to_used : str | None = None
41+
4042 # For recursive bias check
4143 # analyzes two data frames with processed indicators and shows differences between them.
4244 def analyze_indicators (self ):
43- pair_to_check = self .local_config [ "pairs" ][ 0 ]
45+ pair_to_check = self .pair_to_used
4446 logger .info ("Start checking for recursive bias" )
4547
4648 # check and report signals
@@ -85,7 +87,7 @@ def analyze_indicators(self):
8587 # For lookahead bias check
8688 # analyzes two data frames with processed indicators and shows differences between them.
8789 def analyze_indicators_lookahead (self ):
88- pair_to_check = self .local_config [ "pairs" ][ 0 ]
90+ pair_to_check = self .pair_to_used
8991 logger .info ("Start checking for lookahead bias on indicators only" )
9092
9193 part = self .partial_varHolder_lookahead_array [0 ]
@@ -138,7 +140,13 @@ def prepare_data(self, varholder: VarHolder, pairs_to_load: list[DataFrame]):
138140
139141 backtesting = Backtesting (prepare_data_config , self .exchange )
140142 self .exchange = backtesting .exchange
143+ if self .pair_to_used is None :
144+ self .pair_to_used = backtesting .pairlists .whitelist [0 ]
145+ logger .info (
146+ f"Using pair { self .pair_to_used } only for recursive analysis. Replacing whitelist."
147+ )
141148 self .local_config ["candle_type_def" ] = prepare_data_config ["candle_type_def" ]
149+ backtesting .pairlists ._whitelist = [self .pair_to_used ]
142150 backtesting ._set_strategy (backtesting .strategylist [0 ])
143151
144152 strat = backtesting .strategy
0 commit comments