본문 바로가기

Python

(3)
anaconda 에 ta-lib 설치 https://blog.quantinsti.com/install-ta-lib-python/ Installation of Ta-Lib in Python: A Complete Guide for all Platforms A hands-on tutorial to install and use Ta-Lib python library, one of the most popular python libraries used by algorithmic traders worldwide. blog.quantinsti.com 터미널에서 아래의 커맨드 입력 conda install -c conda-forge ta-lib
ohlcv 데이터 plotlib 시각화 기초 아래와 같은 ohlcv 데이터를 선그래프로 간단히 도시하는 샘플 코드 time open high low close volumn 2021-01-01 00:00:00 28923.63 29017.50 28913.12 28975.65 182.889878 2021-01-01 00:05:00 28975.65 28979.53 28846.28 28858.94 214.568104 2021-01-01 00:10:00 28858.94 28883.20 28690.17 28752.80 442.619587 2021-01-01 00:15:00 28752.80 28852.48 28720.91 28820.72 174.839779 2021-01-01 00:20:00 28822.17 28846.46 28744.09 28846.46 161..
Series Timestamp 형식의 데이터를 to yyyy-mm-dd HH:MM 문자열로 변환 0 1609459200000 1 1609459500000 2 1609459800000 3 1609460100000 4 1609460400000 Name: time, dtype: int64 위 같이 타임스템프 형식의 Series 데이터를 yyyymmdd 형식의 문자열로 변환 시 import pandas as pd s1 = pd.to_datetime(time_data, unit="ms") # unit은 밀리세컨드로 설정 # time_data는 위 timestamp 데이터의 변수 s1.dt.strftime("%Y-%m-%d %H:%M") 데이터 를 확인하면 아래와 같이 timestamp -> yyyy-mm-dd HH:MM 형식으로 변환된 것을 확인할 수 있음. 0 2021-01-01 00:00 1 2021-0..