From 33c56d8f6c92d75091e1702cfda781f9a7044bb8 Mon Sep 17 00:00:00 2001 From: Gourav Kumar Date: Sun, 12 Jun 2022 21:35:37 +0530 Subject: [PATCH] bug fix in sortino --- pyfacts/statistics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfacts/statistics.py b/pyfacts/statistics.py index 61c782d..0b133f5 100644 --- a/pyfacts/statistics.py +++ b/pyfacts/statistics.py @@ -1,8 +1,8 @@ from __future__ import annotations import datetime +import math import statistics -from cmath import sqrt from typing import Literal from pyfacts.core import date_parser @@ -567,7 +567,7 @@ def sortino_ratio( excess_returns = annualized_average_rr - risk_free_rate sd = statistics.stdev([i for i in average_rr_ts.values if i < 0]) - sd *= sqrt(365 / interval_days) + sd *= math.sqrt(365 / interval_days) sortino_ratio_value = excess_returns / sd return sortino_ratio_value