I have an arima Model trained in a dataset of train[:350] test[350:427] values. I Am fitting the model in train values and my (p,d,q) values are (1,1,2). Currently i can predict only one time step at a time. I want to run the model in loop so that everytime it outputs one forecasted value, it is added to the train dataset and the new value is used to predict another new forecasted value. I am unable to understand how to do it and so far this is what i have got.
historical = train['max']
predictions = []
for t in range(len(test)):
model = ARIMA(historical, order=(1,1,2))
model_fit = model.fit()
output = model_fit.forecast(exog=test['max'][t])
predictions.append(output)
observed = test['max'][t]
historical.append(predictions)
print(len(historical))