Skip to content

Commit

Permalink
chore: don't use numpy deprecated NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Jan 2, 2025
1 parent d1f31f8 commit 737fb06
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ extend-select = [
# "RSE", # flake8-raise
# "TCH", # flake8-type-checking
# "PTH", # flake8-use-pathlib
"NPY", # numpy
]


Expand Down
2 changes: 1 addition & 1 deletion technical/bouncyhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def bounce(dataframe: DataFrame, level):

open = dataframe["open"]
close = dataframe["close"]
touch = shift(touches(dataframe, level), 1, cval=np.NAN)
touch = shift(touches(dataframe, level), 1, cval=np.nan)

return np.vectorize(_bounce)(open, close, level, touch)

Expand Down
2 changes: 1 addition & 1 deletion technical/candles.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def heikinashi(bars):
)
result["candle"] = np.vectorize(_candle_type)(result["open"], result["close"])
result["reversal"] = np.vectorize(_reversal)(
result["candle"], shift(result["candle"], 1, cval=np.NAN)
result["candle"], shift(result["candle"], 1, cval=np.nan)
)

result["lower_wick"] = np.vectorize(_wick_length)(
Expand Down
4 changes: 2 additions & 2 deletions technical/indicators/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ def SSLChannels(dataframe, length=10, mode="sma"):
ma_high = ta.EMA(df["high"], length)
ma_low = ta.EMA(df["low"], length)

df["hlv"] = np.where(df["close"] > ma_high, 1, np.where(df["close"] < ma_low, -1, np.NAN))
df["hlv"] = np.where(df["close"] > ma_high, 1, np.where(df["close"] < ma_low, -1, np.nan))
df["hlv"] = df["hlv"].ffill()

df["sslDown"] = np.where(df["hlv"] < 0, ma_high, ma_low)
Expand Down Expand Up @@ -1237,7 +1237,7 @@ def PMAX(dataframe, period=10, multiplier=3, length=12, MAtype=1, src=1): # noq
)

# Mark the trend direction up/down
df[pmx] = np.where((df[pm] > 0.00), np.where((df[mavalue] < df[pm]), "down", "up"), np.NaN)
df[pmx] = np.where((df[pm] > 0.00), np.where((df[mavalue] < df[pm]), "down", "up"), np.nan)
# Remove basic and final bands from the columns
df.drop(["basic_ub", "basic_lb", "final_ub", "final_lb", mavalue], inplace=True, axis=1)

Expand Down

0 comments on commit 737fb06

Please sign in to comment.