[Python] 볼린저밴드(BB)를 추출하기 위한 코드(2)
2024. 1. 11. 06:20ㆍ카테고리 없음
볼린저밴드를 추출하기 위한 코드를 이전에 pandas_ta 라이블러리를 통하여 추출하는 방법을 알아보았다.
이번에는 다른 방법으로 알아보고자 한다.
관련링크
[Python] 볼린저밴드(BB)를 추출하기 위한 파이썬 코드
쿼트 자동화를 위하여 볼린저밴드를 활용한 매수의 진입시점을 확인하고자 하여 볼린저밴드 추출방법을 공유하고자 합니다 . 1. 라이블러리 설치 pip install pasdas_ta 2. 데이터프레임 추출 df = self.G
pi000.tistory.com
1. 라이블러리 설치
pip install finta
2. 데이터프레임 추출
df = self.GetOhlcv(stock_code, "D")
3. 데이터프레임을 볼린저밴드로 변환
from finta import TA
BB = TA.BBANDS(self.df, 20)
print(BB)
BBL_01 = BB.BB_LOWER.iloc[-1]
BBL_02 = BB.BB_LOWER.iloc[-2]
BBL_03 = BB.BB_LOWER.iloc[-3]
BBL_04 = BB.BB_LOWER.iloc[-4]
BBM_01 = BB.BB_MIDDLE.iloc[-1]
BBM_02 = BB.BB_MIDDLE.iloc[-2]
BBM_03 = BB.BB_MIDDLE.iloc[-3]
BBM_04 = BB.BB_MIDDLE.iloc[-4]
BBU_01 = BB.BB_UPPER.iloc[-1]
BBU_02 = BB.BB_UPPER.iloc[-2]
BBU_03 = BB.BB_UPPER.iloc[-3]
BBU_04 = BB.BB_UPPER.iloc[-4]
정상적으로 추출되었다.
https://github.com/peerchemist/finta
GitHub - peerchemist/finta: Common financial technical indicators implemented in Pandas.
Common financial technical indicators implemented in Pandas. - GitHub - peerchemist/finta: Common financial technical indicators implemented in Pandas.
github.com
반응형