import pandas as pd
import yfinance as yf
import matplotlib
import datetime
from datetime import date, timedelta
matplotlib.use('TkAgg')
today = date.today()
d1 = today.strftime("%Y-%m-%d")
end_date = d1
d2 = date.today() - timedelta(days=365)
d2 = d2.strftime("%Y-%m-%d")
start_date = d2
data = yf.download('INTC',
start=start_date,
end=end_date,
progress=False)
data["Date"] = data.index
data = data[["Date", "Open", "High", "Low", "Close", "Adj Close", "Volume"]]
data.reset_index(drop=True, inplace=True)
print(data.tail())
data = data[["Date", "Close"]]
print(data.head())
model = auto_arima(data["Close"],
test='adf',
seasonal=True,
trace=True, D=1,d=1,
error_action='ignore',
suppress_warnings=True,
stepwise=True)
model.summary()
This code block I use for deciding p d q order, and it seems whenever I change the dataset, by using yfinance it gives the same order,
I tried to decompose the data and it has a sesonality.
We can see it also has a trend.
The problem I suspect is with differencing, when i use this code:
data['Diff'] = data['Close'] - data['Close'].shift(1)
It says the p,d,q order is 0,0,0 so it just chagned the 0,1,0. Wonder what is the problem.