본문 바로가기

Programming/Python for Stock Analysis

Stochastic Oscillator(스탁캐스틱) 구현하기 using Python | Making Stochastic Oscillator by using Python The stochastic oscillator is calculated using the following formula: %K = 100(C - L14)/(H14 - L14) Where: C = the most recent closing price L14 = the low of the 14 previous trading sessions H14 = the highest price traded during the same 14-day period %K= the current market rate for the currency pair %D = 3-period moving average of %K 이 지표의 기초가 되는 일반적인 이론은 상승 추세에 있는 시장에서는 종가가 당일 최고가 근접 가격에 형성될 것이.. 더보기
볼린저밴드 구현하기 using python | Cal Bollinger bands using Python 파이썬을 이용해서 볼린저밴드 구현하기 Ver. 0.1def anaylize_bolllinger(df,dir_name,dest_path,date_list): df_normalize=df['Close']/df['Close'].ix[0,:] # Compute rolling mean,rolling standard deviation,upper and lower band of Bollinger rm=df['Close'].rolling(window=20,center=False).mean() rmstd=df['Close'].rolling(window=20,center=False).std() upper_band, lower_band = get_bollinger_bands(rm,rmstd) dp=df['Close'].ro.. 더보기
python pandas 에서 특정 컬럼값의 row 를 제거하기 | Deleting DataFrame row in Pandas based on column value 파이썬의 Pandas를 사용하면서 특정값의 row 가 존재할 때, 이 row 를 제거하기위해서는 그 값이 들어가는 row를 제외한 나머지 값들을 다시 dataframe으로 지정해주면 손쉽게 데이터를 처리할 수 있다. 위의 그림은 어느 특정 데이터에서 'Volume'값이 0인 값이 존재하는 row가 2개 있는 그림이다. 여기에서 이 두 항목을 제거하고 다른 데이터 핸들링이 필요할 경우에 유용하다. 아래 그림은 그 결과값이다. 더보기