Introduce File versions to hyperopt result files

This commit is contained in:
Matthias
2021-06-15 20:27:46 +02:00
parent a7e9e362b7
commit d4514f5f16
4 changed files with 14 additions and 10 deletions

View File

@@ -5,6 +5,7 @@ from typing import Any, Dict, List
from colorama import init as colorama_init
from freqtrade.configuration import setup_utils_configuration
from freqtrade.constants import FTHYPT_FILEVERSION
from freqtrade.data.btanalysis import get_latest_hyperopt_file
from freqtrade.enums import RunMode
from freqtrade.exceptions import OperationalException
@@ -133,13 +134,14 @@ def start_hyperopt_show(args: Dict[str, Any]) -> None:
show_backtest_result(strategy_name, metrics,
metrics['stake_currency'])
# Export parameters ...
# TODO: make this optional? otherwise it'll overwrite previous parameters ...
fn = HyperoptTools.get_strategy_filename(config, strategy_name)
if fn:
HyperoptTools.export_params(val, strategy_name, fn.with_suffix('.json'))
else:
logger.warn("Strategy not found, not exporting parameter file.")
if val.get(FTHYPT_FILEVERSION, 1) >= 2:
# Export parameters ...
# TODO: make this optional? otherwise it'll overwrite previous parameters ...
fn = HyperoptTools.get_strategy_filename(config, strategy_name)
if fn:
HyperoptTools.export_params(val, strategy_name, fn.with_suffix('.json'))
else:
logger.warn("Strategy not found, not exporting parameter file.")
HyperoptTools.show_epoch_details(val, total_epochs, print_json, no_header,
header_str="Epoch details")