diff --git a/octobot/strategy_optimizer/strategy_design_optimizer.py b/octobot/strategy_optimizer/strategy_design_optimizer.py index b6d6800bf..3247e5bdd 100644 --- a/octobot/strategy_optimizer/strategy_design_optimizer.py +++ b/octobot/strategy_optimizer/strategy_design_optimizer.py @@ -733,7 +733,9 @@ async def _generate_and_store_backtesting_runs_schedule(self): def shuffle_and_select_runs(runs, select_size=None) -> dict: shuffled_runs = list(runs.values()) random.shuffle(shuffled_runs) - selected_runs = shuffled_runs if select_size is None else shuffled_runs[:select_size] + selected_runs = (shuffled_runs + if (select_size is None or select_size >= len(shuffled_runs)) + else shuffled_runs[:select_size]) return {i: run for i, run in enumerate(selected_runs)} def _generate_runs(self):