From fbe5cc44da260d50db28dedf5acd12aad06913ce Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Sun, 16 Feb 2020 13:43:23 +0300 Subject: [PATCH] Use statistics.pstdev --- freqtrade/optimize/hyperopt_loss_sortino_daily.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/hyperopt_loss_sortino_daily.py b/freqtrade/optimize/hyperopt_loss_sortino_daily.py index 26eb54c25..09042cb48 100644 --- a/freqtrade/optimize/hyperopt_loss_sortino_daily.py +++ b/freqtrade/optimize/hyperopt_loss_sortino_daily.py @@ -5,6 +5,7 @@ This module defines the alternative HyperOptLoss class which can be used for Hyperoptimization. """ import math +import statistics from datetime import datetime from pandas import DataFrame, date_range @@ -52,7 +53,7 @@ class SortinoHyperOptLossDaily(IHyperOptLoss): sum_daily['downside_returns'] = 0 sum_daily.loc[total_profit < 0, 'downside_returns'] = total_profit total_downside = sum_daily['downside_returns'] - down_stdev = total_downside.std() + down_stdev = statistics.pstdev(total_downside, 0) if (down_stdev != 0.): sortino_ratio = expected_returns_mean / down_stdev * math.sqrt(days_in_year)