import pandas as pd import matplotlib.pyplot as plt class Util: def analyze(self): data = pd.read_csv("data_s.csv") y_value = data.종가 max20 = y_value.rolling(window=20).mean() stddev = y_value.rolling(window=20).std() upper = max20 + (stddev * 2) # 상단 볼리저 밴드 lower = max20 - (stddev * 2) # 하단 볼리저 밴드 middle = (upper + lower) / 2 # 중심 x_value = [i for i in range(len(y_value))] plt.plot(x_value, y_value.tolist(), x_value, upper.tolist(), x_value, lower.tolist(), x_value, middle.tolist()) plt.show() return if __name__ == "__main__": util = Util() util.analyze()