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

View File

@@ -17,7 +17,7 @@ class Stochastic:
# n=15 (%k), m=5 (%d), t=3
# n=5 (%k), m=3 (%d), t=3
# n=14 (%k), m=3 (%d), t=3
def apply(self, df, n=14, m=3, t=3):
def apply(self, df, n=12, m=5, t=5):
# 입력받은 값이 dataframe이라는 것을 정의해줌
df = pd.DataFrame(df)