Stock market price prediction model based on grey prediction and ARIMA

. Nowadays more and more people like to invest in volatile assets, and it is the goal of every market trader to maximize the total return by developing a reasonable investment strategy. We first predicted the daily value of gold and bitcoin for five years based on known data, we built two models, one is Improved Metabolic Gray Model (Abbreviated as IGM), the other is Time Series Model ARIMA. The application of the model helps investors make investment decisions and improve economic returns.


Introduction
Market traders buy and sell volatile assets frequently, with a goal to maximize their total return. There is usually a commission for each purchase and sale. Two such assets are gold and bitcoin.Gold, as a general equivalent, is a constant in asset allocation. Gold has been widely used throughout the world as money, [1] for efficient indirect exchange (versus barter), and to store wealth in hoards. For exchange purposes, mints produce standardized gold bullion coins, bars and other units of fixed weight and purity.
Bitcoin is a decentralization-based, peer-to-peer network and consensus initiative, open source code, with blockchain as the underlying technology cryptocurrency [2]. Bitcoin is an innovative payment network and a new kind of money. And it is the first decentralized digital currency. They are transferred directly from person to person via net without going through a bank or clearing house. The transaction fees are much lower and you can use them in every country.From its initial unpopularity to its worldwide recognition, Bitcoin's high returns come with high risks. They have a high volatility [3][4].

GM (1,1)
GM (1, 1), pronounced as "Grey Model First Order One Variable.", is a time series forecasting model, which is able to make accurate predictions for forecasting of the monotonous type of processes. Details are as follows: First set the original sequence  satisfying first-order homogeneous differential equation (4) the satisfaction condition of this differential equation is when , the solution of the equation is (6) the discrete values sampled for equal intervals are (7) when , the first-order homogeneous differential equation can be transformed into (9) that is  when , the solution is fitted value, when , the solution is predicted value.

Pretest
Whether a a given sequence can built GM(1,1) model with high accuracy is generally determined by the class ratio of . The class ratio need to meet certain intervals.
The definition of class ration is then can built GM(1,1) mode. Considering the volatility of asset values and the small amount of data just starting to forecast, we let , and we find . Conditions are met to the model.

Process and result
We realize the above modeling process by programming. We improve the model by carefully considering the cycles of asset volatility,we bring , , , into the equation separately and use GM(1,1) to predict the data for five years [5]. We find that the best result is bring , into the equation separately and average the two sets of predicted values obtained. As shown in figure1 ,the prediction is very accurate [6].

Post-test and model evaluation
We test the accuracy of magic by residual test. First calculate Then do cumulative reduction calculation And then calculate absolute error (A.E.) and relative Error (R.E.) R.E.
We find that almost all of the are less than 20%, which are reasonable, except for some values. We call them 'Abnormal Values' and list them in the following table. All the abnormal values come from bitcoin predictions [7]. By observing the table, we find that there is a very large error in the predicted value, on March 13, 2020 bitcoin plummeted from 7936.65 on the 12th to 4830.21, an increase of -39.1404434%. By checking the information, we know the plunge on that day was due to the outbreak of the global new coronavirus epidemic . In addition, many investors' disappointment in the market accelerated after US President Trump announced on Wednesday night that travelers from 26 "Schengen Convention countries" would be restricted from entering the United States for 30 days from Friday (13th), in addition to the United Kingdom and Ireland [8].The plunge on the 13th also had an impact on the forecast value on the 15th, which was low.
We know that bitcoin is very volatile and various factors can affect its value, the influencing factors are twofold: market and government macro-regulation. The outbreak of the black swan event of the new crown epidemic, the U.S. government's implementation of entry controls, and the greatly reduced market demand caused bitcoin to plummet. There are also some other reasons, such as the February 5, 2018, Global regulators banning, UK and US bankers banning the use of credit cards to buy bitcoin, etc. have caused a lot of concern in the market. The same lead to a high forecast [9].
The virtual currency exchanges FireCoin and OKCoin Coin announced that "only RMB trading business will be stopped, but the rest of the business will not be affected" on September15,2017. Some people see this as a way to continue coin trading on the platform or to provide information aggregation of individual-to-individual virtual currency trading business, so the market demand is somewhat higher and the forecast is low [10].
Large deviations are due to the objective reasons, which cause market changes or government regulation, and bitcoin plunged after a period of growth or rebounded after a period of decline. In addition, the abnormal value only accounted for 0.4939627%, which shows that the GM(1,1) model we built is relatively accurate in its forecast.

Time Series Model
We then use Time Series Model ARIMA [5] to predict the five years' daily prices of the two assets.

ARIMA
ARIMA models are applied in some cases where data show evidence of non-stationarity in the sense of mean (but not variance/autocovariance), where an initial differential step (corresponding to the "integrated" part of the model) can be applied one or more times to eliminate the non-stationary of the mean function (i.e., the trend). [6]The AR part of ARIMA indicates that the evolving variable of interest is regressed on its own lagged (i.e., prior) values. The MA part indicates that the regression error is actually a linear combination of error terms whose values occurred contemporaneously and at various times in the past. [7] The I (for "integrated") indicates that the data values have been replaced with the difference between their values and the previous values (and this differential process may have been performed more than once). The purpose of each of these features is to make the model fit the data as well as possible.Our modeling process is as follows.

Figure 2. ARIMA algorithm
Here are the ARIMA forecasts for gold. For the value of gold on non-trading dates, we choose to skip.Firstly we perform the first-order difference operation and the second-order difference operation.The difference between the first-order difference result and the second-order is not much, and if we use the second-order difference there will be over fitting, so we choose the result of the first-order difference processing.  Then we use smoothing method to process the data, but the results are not good. less than 1%, 5%, 10% at the same time that means very good rejection of the hypothesis, in this data, the ADF result is -6.9, which is less than the statistical value of three levels.
The p-value of 0.184617 is less than the significance level of 0,05, so the hypothesis can be rejected with 95% confidence level and the series is considered as non-white noise series.
ACF,PACF are determined by using trailing and truncated tails.

Figure 7. AIC
The prediction process for bitcoin is the same as for gold.We use the model ARIMA(1,1,7) to predict gold, use ARIMA(0,1,10) to predict bitcoin by programming. The results are shown in figure8.

Model Comparison
Compared to Time Series Model, the Improved Metabolic Gray Model predicts more accurately by comparing the two models' abnormal value percentage.

Conclusion
Investment in volatile assets requires relevant practitioners to formulate reasonable investment strategies to maximize the total return. In view of the current needs of financial investors to expand their income, this paper establishes an improved metabolic grey model and ARIMA model based on the known data to predict the daily value of gold and bitcoin in five years. Compared to Time Series Model, the Improved Metabolic Gray Model predicts more accurately by comparing the two models' abnormal value percentage. The application of the model helps investors make correct investment decisions and improve economic benefits.