Skip to content

Commit

Permalink
[Optimizer] fix shuffle runs on runs less than select size
Browse files Browse the repository at this point in the history
  • Loading branch information
techfreaque committed Feb 16, 2023
1 parent 305e583 commit 0faafe3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion octobot/strategy_optimizer/strategy_design_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 0faafe3

Please sign in to comment.