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] 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