This commit is contained in:
dsyoon
2022-02-04 12:08:03 +09:00
parent 579ff520c5
commit b72f6c0f55
4 changed files with 15 additions and 12 deletions

View File

@@ -17,7 +17,7 @@ class RSI:
self.common = Common()
return
def apply(sefl, df, period=10):
def apply(sefl, df, period=14, window=9):
df = pd.DataFrame(df)
# df.diff를 통해 (기준일 종가 - 기준일 전일 종가)를 계산하여 0보다 크면 증가분을 감소했으면 0을 넣어줌
@@ -33,7 +33,7 @@ class RSI:
AD = pd.DataFrame(D).rolling(window=period, min_periods=period).mean()
rsi = AU.div(AD + AU) * 100
rsis = rsi.rolling(window=9).mean()
rsis = rsi.rolling(window=window).mean()
df = df.assign(rsi=rsi, rsis=rsis)
return df