From 370d0b2682ea7d6fb039bca406084c37d7a99833 Mon Sep 17 00:00:00 2001 From: Frank Milthaler Date: Tue, 26 Sep 2023 14:10:41 +0200 Subject: [PATCH] levels should be >0 and <100 --- finquant/momentum_indicators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finquant/momentum_indicators.py b/finquant/momentum_indicators.py index b6f7521..27bb125 100644 --- a/finquant/momentum_indicators.py +++ b/finquant/momentum_indicators.py @@ -38,8 +38,8 @@ def relative_strength_index( # validating levels if oversold >= overbought: raise ValueError("oversold level should be < overbought level") - if oversold >= 100 or overbought >= 100: - raise ValueError("levels should be < 100") + if not (0 < oversold < 100) or not(0 < overbought < 100): + raise ValueError("levels should be > 0 and < 100") # converting data to pd.DataFrame if it is a pd.Series (for subsequent function calls): if isinstance(data, pd.Series): data = data.to_frame()