From 21cacfaf0c32647e455fcbde9640b1c390da9080 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Tue, 7 Jan 2025 09:29:20 -0800 Subject: [PATCH] Import where() directly instead of importing the entire numpy package in RSI 25 / 75 strategy --- strategies/rsi_25_75.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/strategies/rsi_25_75.py b/strategies/rsi_25_75.py index 041b4d1..65442ce 100644 --- a/strategies/rsi_25_75.py +++ b/strategies/rsi_25_75.py @@ -1,5 +1,4 @@ -import numpy as np - +from numpy import where from pandas import DataFrame, Series from indicators import sma, rsi @@ -17,4 +16,4 @@ def rsi_25_75(data: DataFrame) -> Series: rsi_below_25 = rsi_4 < 25 conditions = above_ma_200 & rsi_below_25 - return Series(np.where(conditions, 'L', 'N'), index = data.index) \ No newline at end of file + return Series(where(conditions, 'L', 'N'), index = data.index) \ No newline at end of file