init
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user