From 8431b54b216396f757e680c195cb49bbf116a156 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Mon, 9 Dec 2019 23:50:40 +0300 Subject: [PATCH] Fix index limits handling --- freqtrade/utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/freqtrade/utils.py b/freqtrade/utils.py index 0ff71e45b..230fcf268 100644 --- a/freqtrade/utils.py +++ b/freqtrade/utils.py @@ -422,14 +422,15 @@ def start_hyperopt_show(args: Dict[str, Any]) -> None: total_epochs = len(trials) trials = _hyperopt_filter_trials(trials, only_best, only_profitable) + trials_epochs = len(trials) n = config.get('hyperopt_show_index', -1) - if n > total_epochs: + if n > trials_epochs: raise OperationalException( - f"The index of the epoch to show should be less than {total_epochs + 1}.") - if n < -total_epochs: + f"The index of the epoch to show should be less than {trials_epochs + 1}.") + if n < -trials_epochs: raise OperationalException( - f"The index of the epoch to show should be greater than {-total_epochs - 1}.") + f"The index of the epoch to show should be greater than {-trials_epochs - 1}.") # Translate epoch index from human-readable format to pythonic if n > 0: