From 6f990c5976549c9abd76a240cd3730125efca724 Mon Sep 17 00:00:00 2001 From: Priveyes <3041616+Pascal66@users.noreply.github.com> Date: Sun, 23 May 2021 18:49:07 +0200 Subject: [PATCH 1/2] Fix a rare error in save_result : ValueError: Out of range float values are not JSON compliant freqtrade/freqtrade/optimize/hyperopt.py", line 166, in _save_result rapidjson.dump(epoch, f, default=str, number_mode=rapidjson.NM_NATIVE) ValueError: Out of range float values are not JSON compliant --- freqtrade/optimize/hyperopt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/optimize/hyperopt.py b/freqtrade/optimize/hyperopt.py index cf5559a24..cba82cee6 100644 --- a/freqtrade/optimize/hyperopt.py +++ b/freqtrade/optimize/hyperopt.py @@ -163,7 +163,7 @@ class Hyperopt: :param epoch: result dictionary for this epoch. """ with self.results_file.open('a') as f: - rapidjson.dump(epoch, f, default=str, number_mode=rapidjson.NM_NATIVE) + rapidjson.dump(epoch, f, default=str, number_mode=rapidjson.NM_NATIVE | rapidjson.NM_NAN) f.write("\n") self.num_epochs_saved += 1 From af16614bf29a6f3235c780c5f9746541e6f66cab Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 24 May 2021 07:48:36 +0200 Subject: [PATCH 2/2] Fix formatting issue --- freqtrade/optimize/hyperopt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/hyperopt.py b/freqtrade/optimize/hyperopt.py index cba82cee6..85bcbb8e3 100644 --- a/freqtrade/optimize/hyperopt.py +++ b/freqtrade/optimize/hyperopt.py @@ -163,7 +163,8 @@ class Hyperopt: :param epoch: result dictionary for this epoch. """ with self.results_file.open('a') as f: - rapidjson.dump(epoch, f, default=str, number_mode=rapidjson.NM_NATIVE | rapidjson.NM_NAN) + rapidjson.dump(epoch, f, default=str, + number_mode=rapidjson.NM_NATIVE | rapidjson.NM_NAN) f.write("\n") self.num_epochs_saved += 1