From da0524c1fd8d72c0818a8e0eb23717a1835e4391 Mon Sep 17 00:00:00 2001 From: ran Date: Thu, 3 Oct 2019 17:58:40 +0300 Subject: [PATCH] fixed issue #7 where daily return >= 100% --- quantstats/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quantstats/utils.py b/quantstats/utils.py index 15f9d142..4a4c0f7f 100644 --- a/quantstats/utils.py +++ b/quantstats/utils.py @@ -172,7 +172,9 @@ def _prepare_prices(data, base=1.): if data[col].dropna().min() <= 0 or data[col].dropna().max() < 1: data[col] = to_prices(data[col], base) - elif data.min() <= 0 and data.max() < 1: + # is it returns? + # elif data.min() < 0 and data.max() < 1: + elif data.min() < 0 or data.max() < 1: data = to_prices(data, base) if isinstance(data, (_pd.DataFrame, _pd.Series)):