Add fixes for comments in the review

This commit is contained in:
hroff-1902 2019-12-05 23:29:31 +03:00
parent 216094a761
commit d21ae4edd3
2 changed files with 8 additions and 1 deletions

View File

@ -22,6 +22,7 @@ from pandas import DataFrame
from skopt import Optimizer from skopt import Optimizer
from skopt.space import Dimension from skopt.space import Dimension
from freqtrade import OperationalException
from freqtrade.data.history import get_timeframe, trim_dataframe from freqtrade.data.history import get_timeframe, trim_dataframe
from freqtrade.misc import plural, round_dict from freqtrade.misc import plural, round_dict
from freqtrade.optimize.backtesting import Backtesting from freqtrade.optimize.backtesting import Backtesting
@ -181,7 +182,7 @@ class Hyperopt:
return result return result
@staticmethod # noqa: C901 @staticmethod
def print_epoch_details(results, total_epochs, print_json: bool, def print_epoch_details(results, total_epochs, print_json: bool,
no_header: bool = False, header_str: str = None) -> None: no_header: bool = False, header_str: str = None) -> None:
""" """
@ -462,6 +463,10 @@ class Hyperopt:
trials: List = [] trials: List = []
if trials_file.is_file() and trials_file.stat().st_size > 0: if trials_file.is_file() and trials_file.stat().st_size > 0:
trials = Hyperopt._read_trials(trials_file) 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.") logger.info(f"Loaded {len(trials)} previous evaluations from disk.")
return trials return trials

View File

@ -360,6 +360,7 @@ def start_test_pairlist(args: Dict[str, Any]) -> None:
def start_hyperopt_list(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 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: def start_hyperopt_show(args: Dict[str, Any]) -> None:
""" """
Show details of a hyperopt epoch previously evaluated
""" """
from freqtrade.optimize.hyperopt import Hyperopt from freqtrade.optimize.hyperopt import Hyperopt