From d21ae4edd35e48be9278c510325a256a66ea9eee Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Thu, 5 Dec 2019 23:29:31 +0300 Subject: [PATCH] Add fixes for comments in the review --- freqtrade/optimize/hyperopt.py | 7 ++++++- freqtrade/utils.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/hyperopt.py b/freqtrade/optimize/hyperopt.py index eb3546756..277aee2fa 100644 --- a/freqtrade/optimize/hyperopt.py +++ b/freqtrade/optimize/hyperopt.py @@ -22,6 +22,7 @@ from pandas import DataFrame from skopt import Optimizer from skopt.space import Dimension +from freqtrade import OperationalException from freqtrade.data.history import get_timeframe, trim_dataframe from freqtrade.misc import plural, round_dict from freqtrade.optimize.backtesting import Backtesting @@ -181,7 +182,7 @@ class Hyperopt: return result - @staticmethod # noqa: C901 + @staticmethod def print_epoch_details(results, total_epochs, print_json: bool, no_header: bool = False, header_str: str = None) -> None: """ @@ -462,6 +463,10 @@ class Hyperopt: trials: List = [] if trials_file.is_file() and trials_file.stat().st_size > 0: trials = Hyperopt._read_trials(trials_file) + if trials[0].get('is_best') is None: + raise OperationalException( + "The file with Hyperopt results is incompatible with this version " + "of Freqtrade and cannot be loaded.") logger.info(f"Loaded {len(trials)} previous evaluations from disk.") return trials diff --git a/freqtrade/utils.py b/freqtrade/utils.py index 4d170985c..91758737e 100644 --- a/freqtrade/utils.py +++ b/freqtrade/utils.py @@ -360,6 +360,7 @@ def start_test_pairlist(args: Dict[str, Any]) -> None: def start_hyperopt_list(args: Dict[str, Any]) -> None: """ + List hyperopt epochs previously evaluated """ from freqtrade.optimize.hyperopt import Hyperopt @@ -403,6 +404,7 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None: def start_hyperopt_show(args: Dict[str, Any]) -> None: """ + Show details of a hyperopt epoch previously evaluated """ from freqtrade.optimize.hyperopt import Hyperopt