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

@@ -20,7 +20,7 @@ from colorama import init as colorama_init
from joblib import Parallel, cpu_count, delayed, dump, load, wrap_non_picklable_objects
from pandas import DataFrame
from freqtrade.constants import DATETIME_PRINT_FORMAT, LAST_BT_RESULT_FN
from freqtrade.constants import DATETIME_PRINT_FORMAT, FTHYPT_FILEVERSION, LAST_BT_RESULT_FN
from freqtrade.data.converter import trim_dataframes
from freqtrade.data.history import get_timerange
from freqtrade.misc import deep_merge_dicts, file_dump_json, plural
@@ -167,7 +167,7 @@ class Hyperopt:
if isinstance(x, np.integer):
return int(x)
return str(x)
epoch[FTHYPT_FILEVERSION] = 2
with self.results_file.open('a') as f:
rapidjson.dump(epoch, f, default=default_parser,
number_mode=rapidjson.NM_NATIVE | rapidjson.NM_NAN)

View File

@@ -46,7 +46,8 @@ class HyperoptTools():
final_params = deep_merge_dicts(params['params_details'], final_params)
final_params = {
'strategy_name': strategy_name,
'params': final_params
'params': final_params,
'ft_stratparam_v': 1,
}
logger.info(f"Dumping parameters to {filename}")
rapidjson.dump(final_params, filename.open('w'), indent=2)