1. None of these models should be used for buying or selling stocks. The article is a tutorial.
2. The model is fitted using the training data and then the loop appends each time a test observation in the history list. This is repeated for all test observations and this is because we need a rolling forecasting procedure.
3. A way To perform this rolling forecast is to re-create the ARIMA model after each new observation is received. We manually keep track of all observations in a list called history that is seeded with the training data and to which new observations are appended each iteration.