Import numpy's where() method directly instead of importing the entire numpy module

This commit is contained in:
moshferatu 2025-01-07 09:27:39 -08:00
parent bb726df31a
commit cc823e44ed

View File

@ -1,4 +1,4 @@
import numpy as np
from numpy import where
from pandas import DataFrame, Series
from indicators import rsi
@ -11,5 +11,5 @@ def five_period_rsi(data: DataFrame) -> Series:
rsi_5 = rsi(data, period = 5)
rsi_below_35 = rsi_5 < 35
signals = np.where(rsi_below_35, 'L', 'N')
signals = where(rsi_below_35, 'L', 'N')
return Series(signals, index = data.index)