I really liked your project! I personally learnt alot from it.
I did notice one thing though. Near the end when you try to build a model that predicts for a day ahead, you predict for all data points in the dataset, even for dates before the year 2013. Now the issue is that you can’t compare the error calculated (which is 5.48) with the one you recieved earlier (22.2). This is due to the fact that the latter error was calculated from the prediction of the years 2013-2015 and the former incorporates all predictions calculated from the year 1951-2015.
The issue is that as you keep going back in time from 2013, the stock market price is lower and lower, which makes the error calculated for each point lower as well. a 10% error for a stock price of 500$ is much lower in value than a 10% error for a stock price of 1,500$. This explains why you got such a low error. I tried to calculate the error for a day ahead only from the year 2013-2015 to have a fair comparison and the error was pretty much the same.
Also, when you are calculating the error in the function for making a prediction for only one day ahead, i think that there is no need to calulate the mean squared error. This is due to the fact that it is only a single prediction, therefore you are squaring then square rooting a single number which is the same as the mean absolute error. Try using mean absolute error and mean squared error in the last step and you will get the same result.
I benefited alot from your project so i thought to point these out while i was on it.