diff --git a/freqtrade/data/metrics.py b/freqtrade/data/metrics.py index 09dd60208..1d2757f8f 100644 --- a/freqtrade/data/metrics.py +++ b/freqtrade/data/metrics.py @@ -239,7 +239,7 @@ def calculate_sortino(trades: pd.DataFrame, min_date: datetime, max_date: dateti down_stdev = np.std(trades.loc[trades['profit_abs'] < 0, 'profit_abs'] / starting_balance) - if down_stdev != 0: + if down_stdev != 0 and not np.isnan(down_stdev): sortino_ratio = expected_returns_mean / down_stdev * np.sqrt(365) else: # Define high (negative) sortino ratio to be clear that this is NOT optimal.