새소식

TIL

자기상관함수(AutoCovariance Function, ACF) 그래프 확인하기

  • -
import pyupbit as pu
import numpy as np 
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.graphics.tsaplots import plot_acf


pu.get_current_price(["KRW-BTC"])
btc = pu.get_ohlcv(ticker="KRW-BTC",interval='minute1',to='2023-04-12 23:59',count=3000).close

plt.figure(figsize=(14,7))
plt.title('Bitcoin')
plt.plot(btc)

 

 

fig, ax = plt.subplots(figsize=(12, 5))
plot_acf(btc, ax=ax, lags=200)
plt.xlabel('Lag')
plt.ylabel('Autocorrelation')
plt.title('Autocorrelation Function (ACF) of BTC Data')

plt.show()

Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.