# Quantitative Investment Trading Model Based on Model Recognition Strategy with Deep Learning Method

Authors: Jiawei Yao; Zixu Li; Tong Cui; Honghua Xi
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

With the acceleration of economic globalization, the frequent price fluctuations of gold and bitcoin and other currencies have attracted wide attention from the quantitative investment industry. For market traders, rational use of deep learning means to improve traditional investment trading strategies has become one of the main contents of current work. In this paper, the deep learning method is used to make a horizontal comparison of the benefit increase of the model recognition strategy with deep learning as the main means compared with the other two strategies, and a longitudinal comparison is made between the deep learning method and the traditional time series of fitting accuracy advantages. We grouped gold and bitcoin prices in the LSTM/GRU framework, trained the recursive dynamic neural network model on the daily data of each group, and used the dropout algorithm to reduce the overfitting effect of the model and retained 20% of the data for cross-checking. The results obtained by this method show that the benefit of the whole neural network model is more obvious when making decisions on the data of the day, and the fitting accuracy of the model is more than 73%, and the average absolute error is 14.040908, indicating a good fitting degree. Compared with model recognition strategies represented by LSTM/GRU, follow-the-winner and follow-the-loser have obvious disadvantages in terms of investment trading principle, and their returns are far lower than the $22,059.583248 obtained under the model recognition strategy. We compare the price trends of gold and bitcoin under ARIMA(2,1,1) and ARIMA(4,1,5) by comparing the LSTM/GRU method under the framework of model recognition with the time series method in model recognition and find that the mean square error is much greater than the fitting results of neural network. Therefore, it is concluded that the model recognition strategy integrating the deep learning model is the best fit and the best profit among the three conditions. Finally, we change the transaction cost of gold and bitcoin to 7% to simulate whether the transaction model in different countries is stable. The conclusion shows that when the transaction cost changes within 7%, the model still has high feasibility and stability and is relatively robust.


---

## Body

## 1. Introduction

With the rapid development of economic globalization and computer technology, the weaknesses of traditional investment methods, such as strong subjectivity, poor stability, and lack of discipline, have become cumulatively prominent. Correspondingly, quantitative investment combined with deep learning algorithm plays an increasingly important role in modern investment decisions.Quantitative investment is a new investment method, which establishes a mathematical model based on modern statistical methods and mathematical knowledge, and deeply studies the huge amount of historical data in the past to find profitable strategies [1]. In 1971, Barclays Global Investors (BGI) launched the first index fund in the world, an event that marked the beginning of quantitative investment. And according to statistics, quantitative trading accounts for about 60-73% of the total US stock trading volume so far. The American Medallion Fund, founded by Simmons, achieved an annualized rate of return as high as 38.5% from 1989 to 2006, and the annualized net rate of return far exceeded the “investment god” Buffett’s return of 21% over the same period. The investment tools used by Simmons are mathematical and statistical models, which to a certain extent explain the superiority of quantitative investment. In this paper, we will focus on the analysis of two investment products, gold and bitcoin as shown in Figure 1, and propose reasonable portfolio investment recommendations.Figure 1
Concept map of gold and bitcoin. On the left is a virtual form of bitcoin, and on the right is a common form of gold.In the past few years, some methods based on data mining and machine learning, such as neural network (NN) and support vector machine (SVM), have achieved good results in classification and regression problems. They have been successfully applied to predict stock price fluctuations [2, 3].Recurrent neural network is an important method in deep learning, which can be used in the fields of portfolio investment and quantitative analysis. At present, the application of this model has achieved good results. Bengio et al. [4] proposed that unsupervised learning can be used in neural networks to determine the weights and thresholds of each layer. Heaton et al. [5] pointed out that long short-term memory network has the process of processing complex time series. With the development of models and new progress made in applied statistics, Hinton et al. [6] and Ba and Frey (2013) studied dropout method to reduce the degree of model overfitting and improved the solution time and generalization ability of the model. In the forecast of exchange rate movements, Dixon et al. [7] successfully predict the direction of commodity spot and futures price movements by building a deep learning network. The forecast range includes 45 futures and spot stocks in the Chicago Exchange, and the model accuracy rate exceeds 73%.In 1991, Cover and Ordentlich first used the ex-ante fund allocation algorithm, successfully achieved optimum allocation of funds. And then the era of online machine learning portfolio models has begun. Haonan [8] thought that online machine learning portfolios can be broken down into three strategies:
(i)
Follow-the-winner: the strategy assumes that there will be inertia in future prices. Future price action will be largely influenced by past inertia. The main representatives are Cover and Ordentlich’s UP algorithm [9] and Helmbold et al.’s EG algorithm [10](ii)
Follow-the-loser: it is expected that security prices will change direction in the future, such as the online reversal investment model proposed by Li et al. [11](iii)
Strategies based on model identification methods: mine the distribution laws behind the data with the help of algorithms and predict and optimize according to the lawsThis paper will first discuss the benefits of the model recognition strategy integrating the deep learning model compared with the other two strategies. The traditional time series model is an excellent strategy to fit the trend of currency price, which has the advantages of timeliness and high interpretability. In order to obtain the optimal model recognition method, this paper will evaluate the effect of long- and short-term recurrent neural network method and time series fitting by longitudinal comparison. In order to simulate the trading process of the two currencies as realistically as possible, we imposed environmental constraints on three strategies, which are embodied in providing investment advice on a daily basis and investing in accordance with the investment advice to achieve maximum investment returns from September 11, 2016. Of the two assets in question, gold can only be traded on fixed dates, while bitcoin can be traded every day. Avoid frequent buying and selling because of the transaction costs involved.First, under the framework of LSTM/GRU model, neural nodes, activation functions, and output functions are designed to build a recurrent neural network that can process long- and short-term time series data. With cross-entropy as the loss function, we apply the dropout model between neural networks to avoid overfitting of the model. Then, output predictions of future returns through historical correlation factors of gold and bitcoin prices. Through the double comparison of LSTM/GRU to realize the model identification and fitting of assets, we compare the different returns under the three strategies and finally prove the superiority of the model identification method.Secondly, when demonstrating that the model identification method is the best income strategy, we firstly obtain the price trend of the two currencies by using traditional ARIMA time series analysis on the prices of gold and bitcoin, respectively. At the same time, we innovatively propose two investment strategies, follow-the-winner and follow-the-loser, which do not depend on model prediction. Then, we compare the income amount and rate of return between the above two investment strategies and the investment strategy that relies on the prediction of the LSTM/GRU model and use five years of price data to simulate in order to find the optimal investment strategy.In the end, we perform multiple solutions and comparisons for different asset allocation ratios to determine the optimal investment amount ratio that can maximize returns under different conditions. Our policies are summarized in Figure2.Figure 2
An overview of trading strategies. Three different quantitative investment trading strategies are compared horizontally. In this paper, the other two strategies are compared horizontally, and the effectiveness of the model recognition method integrated with deep learning is investigated vertically.


## 2. Assumption and Notations

To simplify our modeling, we make the following main assumptions in this paper:(i)
Traders are rational and have no subjective preference for gold and bitcoin investments. In order to fully demonstrate the role of the model in the trading process, we need to dilute the influence of personal subjective consciousness on the trading strategy; otherwise, the advantages and disadvantages of the whole model will not be obvious. Return on investment is the only factor traders consider when deciding which assets to buy, hold, or sell in their portfolios(ii)
The overall rules of the entire trade do not change during the period under discussion and the trader is risk neutral. Risk neutral is different from risk avoiders and risk lovers. The marginal utility of risk neutral is constant with the increase of risk(iii)
Different transaction costs reflect that traders are in different countries or regions and can also simulate traders facing different financial derivatives. A robust model needs to be able to adapt to different environments. We simulate different financial products by setting different transaction costs, or traders are in different countries or regions. This can prove the robustness of the whole model more strongly


## 3. Deep Learning Analysis in Quantitative Investing

### 3.1. Intelligent Algorithm Price Fit Model

The intelligent algorithm model has good adaptability and flexibility, and its brief process is shown in Figure3. However, data preprocessing and sample training must be performed before operation with traditional statistical rules.Figure 3
The most basic neural network concept diagram. The entire network is composed of input layer, hidden layer, and output layer.Avoid the influence of the scale and standardize the data. It is assumed that there isN to evaluate objects, M evaluating indicators, and the matrix X and its standardized matrix Z are
(1)X=x11x12⋯x1mx21x22⋯x2m⋮⋮⋱⋮xn1xn2⋯xnm,(2)Z=z11z12⋯z1mz21z22⋯z2m⋮⋮⋱⋮zn1zn2⋯znm,where each element in Z is zij=xij/∑i=1nxij2..With the price data of 2016.9.11-2021.9.9, the sample interval is divided into 10 different stages, each stage is used as a training in 80%, and 20% is used as a test, and the circular dynamic training fit is performed.


#### 3.1.1. LSTM Fit

LSTM is a long short-term memory network, and its basic unit is shown in Figure4. In the model, each sequence index position will be propagated forward at time t. In addition to the same hidden state ht as the general recurrent neural network, there is an additional hidden state. The hidden state is called the cell state Ct(Cell State), and Ct essentially plays the role of the hidden layer state ht in the general recurrent neural network in LSTM. In addition to other structures in the cell state, which are called gated structures (Gate), the gated structure of each sequence index position t generally includes a forget gate, an input gate, and an output gate. The basic structural units are as follows:Figure 4
LSTM basic unit, which is a deep learning optimization method based on the traditional neural network adding forgetting gate structure, aiming at solving the neural network structure with memory.The Forcer Door is responsible for control whether or not to forget the hidden cell state of the previous layer; the expression is(3)ft=σWfht−1+Ufxt+bf.σ is called a sigmoid activation function. Since the value of ft is between [0, 1], it represents the probability of forgetting the status of the previous layer. When new variables xt and I want to predict the next word, we hope to go to the last variable some of the features of ht−1.The input door is responsible for controlling whether the current time input variablext incorporates cell state; the expression is
(4)it=σWiht−1+Uixt+bi,C~t=tanhWcht−1+Ucxt+bc.In the formula,it∈0,1 represents the probability of remembering this layer input information. The information needs to be added by the current cell status by it and C~t. The result of the former cell state and the input door will act on the current cell state Ct; the expression is
(5)Ct=Ct−1eft+C~teit.Finally, the output door portion of the model is to create a hidden stateht from the cell Ct; the expression is
(6)ot=σWoht−1+Uoxt+bo,ht=otetanhCt.The BTC price fitted by LSTM is shown in Figure5, and the gold price fitted by LSTM is shown in Figure 6.Figure 5
LSTM prediction of BTC. LSTM has a high coincidence rate in the trend of fitting curves, but some values still have a large error.Figure 6
LSTM prediction of gold. Compared with BTC price fitting, the fitting result of gold is more in line with experimental expectations, and the curve trend fitting degree is better, and the accuracy is higher.


#### 3.1.2. GRU Fit

GRU is a gated recurrent unit, which is simplified on the basis of LSTM. In the GRU model, the memoryht combines long-term memory and short-term memory, and ht contains the past information ht−1 and the present information h~t. The current information is determined by the past information and the current input through the reset gate. The value range of each threshold is 0 to 1. During forward propagation, the value of ht at each moment can be calculated directly by using the memory update formula.
(i)
Reset gatezt=σWz·ht−1,xt(ii)
Update gatert=σWz·ht−1,xt(iii)
Memoryht=1−zi∗ht−1+zt∗h~t(iv)
Candidate hidden layerh~t=tanhW·rt∗ht−1,xtThe BTC price fitted by GRU is shown in Figure7, and the gold price fitted by GRU is shown in Figure 8.Figure 7
GRU prediction of BTC. GRU corrects the hysteresis of LSTM to some extent, making the fitting accuracy more in line with expectations.Figure 8
GRU prediction of gold. As the gold data is relatively stable, the goodness of fit of GRU and LSTM are similar.In summary, by observing each fitting curve, the recurrent neural network can achieve a more accurate fitting for complex data, and accurate fitting is the basis for obtaining the optimal strategy. In this paper, we use the LSTM model and the GRU model to strengthen each other’s accuracy and obtain a very ideal fitting curve, which will be used for future price prediction and income calculation.


### 3.2. Strategy Proposal

At present, there is an accurate price prediction model, and the model recognition strategy based on the recurrent neural network that we have envisaged before can be realized. At the same time, in the exploration of portfolio investment, we also found other simpler investment strategies.In the investment problem, the trading strategy at a certain moment will be determined by the price of the next stage, and for a certain stage in the future (a short period of time), there are only two trends of rising and falling. According to this law, two basic investment strategies that do not rely on forecasts can be proposed. The specific explanation is as follows:(i)
The follow-the-winner inertial investment strategy: according to the change trend in a period of time before this day, it is subjectively believed that the change in a short period of time after should be the same as before, that is, maintain a certain inertia. Therefore, the optimal investment strategy will be determined by the same changing trends as in the previous stage(ii)
The follow-the-loser reversal investment strategy: according to the change trend in a period of time before this day, it is subjectively believed that the change in a short period of time after should be opposite to the previous one, that is, a decision-making method that is completely opposite to the follow-the-winner strategy(iii)
Follow-the-winner: the strategy assumes that there will be inertia in future prices. Future price action will be largely influenced by past inertia. The main representatives are Cover and Ordentlich’s UP algorithm [9] and Helmbold et al.’s EG algorithm [10](iv)
Follow-the-loser: it is expected that security prices will change direction in the future, such as the online reversal investment model proposed by Borodin et al. [12] and Li et al. [11](v)
Strategies based on model identification methods: mine the distribution laws behind the data with the help of algorithms and predict and optimize according to the laws


### 3.3. Optimistic Strategic Argumentation

At present, two other investment strategies have been added, namely, follow-the-winner inertial investment strategy and follow-the-loser reversal investment strategy. At the same time, we also found that the traditional time series ARIMA model can also predict the price to guide the investment strategy. Under these strategies, whether the model identification strategy still has a leading advantage, we will demonstrate one by one next.


### 3.4. Horizontal Comparison: Model Identification versus Two Different Strategies

#### 3.4.1. Follow-the-Winner Inertial Investment Strategy Analysis

In this strategy, the optimal investment strategy is determined by following the price inertia of the previous stage. Therefore, in order to avoid the impact of short-term fluctuations in the data on the results, we analyze the price trends of the two assets and use the average volatility of bitcoin and gold prices in the last 5 periods (MA5) as an indicator.(7)MA5=∑i=510xi/5−∑i=05xi/5∑i=05xi/5×100%.Depending onMAi–1 with MAi positive and negative, the model can be divided into two situations, respectively, which correspond to actual buy and sell operations as Table 1.Table 1
Buy sell selection under the follow-the-winner strategy.
ConditionsDecision makingMAi−1<0 and MAi>0BuyMAi<0 and MAi−1>0SellWe consider gold and bitcoin and allocate initial cash of 500 yuan, each with the use of follow-the-winner strategy computational benefits and trading volume, and data and part of the results are presented as Figures9 and 10Figure 9
Gold price chart and earning cash.Figure 10
Bitcoin price chart and earning cash.It can be obtained by calculation from Table2 that in 5 years, when the initial capital of bitcoin and gold is, respectively, invested 500 US dollars, there are 60 buys and 60 sells of bitcoin transactions. In the case of a 98% derating rate, the total income is $1068.703029; in the case of a 99% derating rate for gold, the final income is $663.9566117, and the total income is $1,732.65. The 5-year overall revenue rate is 173.2%, which is in line with expectations.Table 2
Follow-the-winner strategy site result.
Total cashNumber of gold in handBitcoin quantity50000.1494643350000.1494643350000.1494643300.380720320.14946433


#### 3.4.2. Follow-the-Loser Reversal Investment Strategy Analysis

The follow-the-loser reversal investment strategy states that future security prices are expected to reverse direction, contrary to previous trends. In the previous paper, we have conducted different analyses on the buying and selling under the follow-the-winner strategy. The results show that when the asset price volatility (volatility is how much the price fluctuates) in the previous stage is negative, and the current price volatility is positive, the winner strategy is more inclined to choose to buy assets to obtain higher returns. When the price volatility of the commodity in the previous stage is positive and the current price volatility is negative, the winner strategy is more inclined to choose to throw the commodity to stop the loss in time. The follow-the-loser strategy is different from this. This strategy believes that when the current currency price fluctuation trend is negative, it proves that there will be a price increase in the future stage, so it chooses the opposite trading option to the winner strategy.From the previous analysis of the price trend of bitcoin and gold, it can be seen that the two assets show an upward trend in prices as a whole. In this case, the reverse operation of the market trend will bring about a large loss, and we will not discuss it again.PS: in the case of the data given by this question, the follow-the-loser reversal investment strategy will bring a lot of losses, but it does not mean that this strategy is incorrect. This strategy will have unique application value in certain security markets where the overall price trend is declining in volatility.


#### 3.4.3. Model Comprehensively Identifying Investment Strategies Based on RNN

Consistent with the previous strategy, the gold and bitcoin are separated, each distribution of $500, with gold as an example; the fit results are shown in Table3.Table 3
GRU gold output.
Layer(type)Output shapeParam #gru(GRU)(None,40,80)19920dropout(Dropout)(None,40,80)0gru_1(GRU)(None,100)54600dropout_1(Dropout)(None,100)0dense(Dense)(None,1)101In this result, the total params is 74,621, trainable params is 74,621, and nontrainable params is 0. The mean square error of the obtained model is 358.258737, the root mean square error is 18.927724, and the mean absolute error is 14.040908. The fit is good, and the model results are in line with expectations.It can be obtained by calculation: in 5 years, when the initial capital of bitcoin and gold is, respectively, invested 500 US dollars, there are 60 buys and 60 sells of bitcoin transactions. In the case of a 98% derating rate, the total income is $21721.60873; a total of 80 purchases and 80 sales of gold are carried out, and in the case of a 99% derating rate, $337.974518 is finally recovered, which means a loss of $162.025482. Gross revenue is $22,059.583248; after deducting costs of $1,000, total revenue is $21,059.583248. The 5-year overall rate of return is at 2105.96%.


### 3.5. Vertical Comparison: Comparison between Deep Learning Methods and Traditional Time Series under Model Recognition

#### 3.5.1. Traditional Time Series Model ARIMA Fitting Analysis

ARIMA time series is one of the best fitting strategies for financial products and stock market price trends. ARIMA is often used as a common method for model recognition and fitting due to its advantages of flexibility and stability. Therefore, in the price fitting of gold and BTC, if we want to show that the model recognition strategy integrating deep learning is better than that based on the traditional model recognition strategy, we need to compare the accuracy of the fitting results of neural network and the traditional time series ARIMA fitting results and analyze the results.(1) Bitcoin Price Fit under ARIMA(2,1,1). Through the fitting of the price trend of the bitcoin, the ARIMA(2,1,1) model can be obtained. We use the parameters mentioned in Table 4 for time series fitting, and the model parameters are shown in Table 5:Table 4
Notation description in the model. Other unmarked symbols are mainly explained where they appear.
SymbolDescriptionyPredict the outcometYearARIMADifferentially integrated moving average autoregressiveAICAkaike information guidelinesBICInformationADFExpanded Dickey-Fuller testACFAutocorrelation functionsPACFPartial autocorrelation functionR2Goodness of fitTable 5
ARIMA(2,1,1) model parameter table.
ItemSymbolCoefficientStandard errorz valuepvalue95% CICon.c24.86219.8861.250.211-14.115~63.839ARα10.4390.2172.0180.0440.013~0.865α20.1020.0244.14500.054~0.149MAβ1-0.5130.218-2.3550.019-0.940~-0.086AIC value: 29601.258; BIC value: 29628.804.Make the following description for this model:(i)
The information criterion AIC and BIC values are used for multiple analysis model comparisons; the lower the two values, the better. If the analysis is performed multiple times, the changes of the two values can be compared to comprehensively explain the optimization process of the model construction(ii)
The ARIMA model requires the model residuals to be white noise; that is, the residuals have no autocorrelation, which can be tested by the Q statistic test (null hypothesis: the residuals are white noise)(iii)
For example, Q6 is used to test whether the first 6-order autocorrelation coefficient of the residual satisfies white noise. Usually, its correspondingp value is greater than 0.1, which means it meets the white noise test (and vice versa, it is not white noise). In common cases, it can be directly analyzed for Q6(iv)
Rejecting the white noise assumption (p<0.05) means that the model fits poorly; otherwise, it usually means that the model can be used normallyFor value, use the AIC information criterion to model and compare multiple alternative models, and finally find the optimal model: ARIMA(2,1,1). Its formula and Q statistics are shown as follows:(8)yt=24.862+0.439∗yt−1+0.102∗yt−2−0.513∗εt−1.From the Q statistic results, thep value of Q6 is greater than 0.1, then the original hypothesis cannot be rejected at a significant level of 0.1, the residual of the model is white noise, the model is basically satisfied, and absolute error is 536.5997966.(2) Gold Price Fit under ARIMA(4,1,5). The gold price model fitted by time series is shown in Table 6.Table 6
ARIMA(4,1,5) model parameter table.
ItemSymbolCoefficientStandard errorz valuep value95% CIConstantc0.3810.3561.0690.285-0.318~1.080ARα1-0.8390.121-6.9030-1.077~-0.601α20.3860.2951.3070.191-0.193~0.965α3-0.2320.311-0.7450.456-0.842~0.378α4-0.5190.131-3.9750-0.775~-0.263MAβ10.8640.1217.12100.626~1.102β2-0.3330.306-1.0870.277-0.932~0.267β30.2780.3440.8070.42-0.397~0.953β40.3870.1672.3130.0210.059~0.714β5-0.1560.033-4.6520-0.221~-0.090AIC value: 10132.380; BIC value: 10188.855.For USD (PM), combined with AIC information guidelines for modeling and comparison, it is finally identified as ARMA(4, 1, 5); its formula and Q statistic show as follows:(9)yt=0.381−0.839∗yt−1+0.386∗yt−2−0.232∗yt−3−0.519∗yt−4+0.864∗εt−1−0.333∗εt−2+0.278∗εt−3+0.387∗εt−4−0.156∗εt−5.According to the results of Table7 of Q statistics, when the p value of Q6 is greater than 0.1 m, the original hypothesis cannot be rejected at the significant level of 0.1. The residual of the model is white noise, the model basically meets the requirements, and the absolute error is 0.006059449.Table 7
Model Q statistics in ARIMA(2,1,1) and ARIMA(4,1,5).
ItemStatisticsp valueItemStatisticsp valueQ600.992Q60.0020.964Q120.8460.991Q124.4730.613Q1849.2590.000∗∗Q1811.0860.522Q2454.6940.000∗∗Q2415.0150.661Q3096.3370.000∗∗Q3025.8950.359(3) ARIMA Time Series Fit Conclusion. From the above results, the effect of using ARIMA time series for the price trend of bitcoin is poor, and the absolute error can reach 536. For the price trend of gold, the fit is better, and the absolute error is only about 0.006.The reason for this is diversity, and the most important of all is that the prices of the two assets do not fluctuate freely with the market but involve many factors. The traditional time series are only based on statistical principles and cannot accurately predict the data itself. Therefore, the ARIMA prediction model has poor stability and poor effect.


#### 3.5.2. Model Comparative Conclusion

In fact, several different strategies are only as good as forecasting the overall price movement of the asset. Comparing the three results, it can be found that the GRU model is better than the other two in overall performance, for three main reasons:(i)
The first two models cannot know the future trend of asset prices on the day because they do not rely on the prediction of the trend. Therefore, the selection of strategies cannot be optimal(ii)
Although the final benefit of the follow-the-winner strategy is not as good as the fitting effect of the GRU in the recurrent neural network, this is not the gap caused by the model itself, but due to the superiority of the GRU model in prediction, after sample training. The predicted data is generally similar to the real data, especially after standardization or normalization, and the order of magnitude of this gap will be further reduced(iii)
Compared with GRU model, the other two strategies have stronger interpretability and weaker hysteresisIn practice, we should consider these three strategies, rather than simply do deep learning algorithm fitting analysis. For the actual quantitative investment, due to historical limitations, we cannot accurately predict whether the future price trend is rising or falling. Therefore, follow-the-winner inertia investment strategy and follow-the-loser reversal investment strategy still have practical application value.When we analyze the three strategies in Figure11, we also roughly consider the application environment of each strategy. It is shown as follows; when the data show the characteristics as shown in the figure, this strategy will have application value.Figure 11
Different strategic selections under different data trends. Follow-the-winner is more suitable for use when the overall price fluctuation shows an upward trend, follow-the-loser is more suitable for use when the overall price fluctuation is in a downward trend, and the model recognition method integrated with deep learning is more suitable for price curve fluctuation under different circumstances.


### 3.6. Strength and Weakness

This paper does not directly analyze and fit the amount of cash, bitcoin, and gold as neural network parameters but considers the case where $1,000 is divided into two equally and invests in bitcoin and gold, respectively. The benefits of doing this are as follows:(i)
It is convenient to consider the handling fee problem in the transaction process, and it is easy to change the handling fee ratio, so as to realize the sensitivity analysis of the model parameters(ii)
By considering the portfolio investment recommendations under different model states, it can be strongly demonstrated from multiple perspectives that the dominant position of deep learning in quantitative trading(iii)
The model is more realistic and has stronger generality and stability. Through independent analysis of different investment portfolios, the model can be applied to quantitative investment transactions in different fields and can be easily migrated to any eligible quantitative trading scenario for useHowever, there are still some shortcomings in the model:(i)
The issue of the coexistence of risks and returns is not considered. In a more real quantitative trading venue, risk is an important factor that coexists with returns(ii)
The extreme conditions of the market are not considered. In fact, special economic conditions are more common in economic transactions, and the research conditions of this paper are ideal


## 3.1. Intelligent Algorithm Price Fit Model

The intelligent algorithm model has good adaptability and flexibility, and its brief process is shown in Figure3. However, data preprocessing and sample training must be performed before operation with traditional statistical rules.Figure 3
The most basic neural network concept diagram. The entire network is composed of input layer, hidden layer, and output layer.Avoid the influence of the scale and standardize the data. It is assumed that there isN to evaluate objects, M evaluating indicators, and the matrix X and its standardized matrix Z are
(1)X=x11x12⋯x1mx21x22⋯x2m⋮⋮⋱⋮xn1xn2⋯xnm,(2)Z=z11z12⋯z1mz21z22⋯z2m⋮⋮⋱⋮zn1zn2⋯znm,where each element in Z is zij=xij/∑i=1nxij2..With the price data of 2016.9.11-2021.9.9, the sample interval is divided into 10 different stages, each stage is used as a training in 80%, and 20% is used as a test, and the circular dynamic training fit is performed.


### 3.1.1. LSTM Fit

LSTM is a long short-term memory network, and its basic unit is shown in Figure4. In the model, each sequence index position will be propagated forward at time t. In addition to the same hidden state ht as the general recurrent neural network, there is an additional hidden state. The hidden state is called the cell state Ct(Cell State), and Ct essentially plays the role of the hidden layer state ht in the general recurrent neural network in LSTM. In addition to other structures in the cell state, which are called gated structures (Gate), the gated structure of each sequence index position t generally includes a forget gate, an input gate, and an output gate. The basic structural units are as follows:Figure 4
LSTM basic unit, which is a deep learning optimization method based on the traditional neural network adding forgetting gate structure, aiming at solving the neural network structure with memory.The Forcer Door is responsible for control whether or not to forget the hidden cell state of the previous layer; the expression is(3)ft=σWfht−1+Ufxt+bf.σ is called a sigmoid activation function. Since the value of ft is between [0, 1], it represents the probability of forgetting the status of the previous layer. When new variables xt and I want to predict the next word, we hope to go to the last variable some of the features of ht−1.The input door is responsible for controlling whether the current time input variablext incorporates cell state; the expression is
(4)it=σWiht−1+Uixt+bi,C~t=tanhWcht−1+Ucxt+bc.In the formula,it∈0,1 represents the probability of remembering this layer input information. The information needs to be added by the current cell status by it and C~t. The result of the former cell state and the input door will act on the current cell state Ct; the expression is
(5)Ct=Ct−1eft+C~teit.Finally, the output door portion of the model is to create a hidden stateht from the cell Ct; the expression is
(6)ot=σWoht−1+Uoxt+bo,ht=otetanhCt.The BTC price fitted by LSTM is shown in Figure5, and the gold price fitted by LSTM is shown in Figure 6.Figure 5
LSTM prediction of BTC. LSTM has a high coincidence rate in the trend of fitting curves, but some values still have a large error.Figure 6
LSTM prediction of gold. Compared with BTC price fitting, the fitting result of gold is more in line with experimental expectations, and the curve trend fitting degree is better, and the accuracy is higher.


### 3.1.2. GRU Fit

GRU is a gated recurrent unit, which is simplified on the basis of LSTM. In the GRU model, the memoryht combines long-term memory and short-term memory, and ht contains the past information ht−1 and the present information h~t. The current information is determined by the past information and the current input through the reset gate. The value range of each threshold is 0 to 1. During forward propagation, the value of ht at each moment can be calculated directly by using the memory update formula.
(i)
Reset gatezt=σWz·ht−1,xt(ii)
Update gatert=σWz·ht−1,xt(iii)
Memoryht=1−zi∗ht−1+zt∗h~t(iv)
Candidate hidden layerh~t=tanhW·rt∗ht−1,xtThe BTC price fitted by GRU is shown in Figure7, and the gold price fitted by GRU is shown in Figure 8.Figure 7
GRU prediction of BTC. GRU corrects the hysteresis of LSTM to some extent, making the fitting accuracy more in line with expectations.Figure 8
GRU prediction of gold. As the gold data is relatively stable, the goodness of fit of GRU and LSTM are similar.In summary, by observing each fitting curve, the recurrent neural network can achieve a more accurate fitting for complex data, and accurate fitting is the basis for obtaining the optimal strategy. In this paper, we use the LSTM model and the GRU model to strengthen each other’s accuracy and obtain a very ideal fitting curve, which will be used for future price prediction and income calculation.


## 3.1.1. LSTM Fit

LSTM is a long short-term memory network, and its basic unit is shown in Figure4. In the model, each sequence index position will be propagated forward at time t. In addition to the same hidden state ht as the general recurrent neural network, there is an additional hidden state. The hidden state is called the cell state Ct(Cell State), and Ct essentially plays the role of the hidden layer state ht in the general recurrent neural network in LSTM. In addition to other structures in the cell state, which are called gated structures (Gate), the gated structure of each sequence index position t generally includes a forget gate, an input gate, and an output gate. The basic structural units are as follows:Figure 4
LSTM basic unit, which is a deep learning optimization method based on the traditional neural network adding forgetting gate structure, aiming at solving the neural network structure with memory.The Forcer Door is responsible for control whether or not to forget the hidden cell state of the previous layer; the expression is(3)ft=σWfht−1+Ufxt+bf.σ is called a sigmoid activation function. Since the value of ft is between [0, 1], it represents the probability of forgetting the status of the previous layer. When new variables xt and I want to predict the next word, we hope to go to the last variable some of the features of ht−1.The input door is responsible for controlling whether the current time input variablext incorporates cell state; the expression is
(4)it=σWiht−1+Uixt+bi,C~t=tanhWcht−1+Ucxt+bc.In the formula,it∈0,1 represents the probability of remembering this layer input information. The information needs to be added by the current cell status by it and C~t. The result of the former cell state and the input door will act on the current cell state Ct; the expression is
(5)Ct=Ct−1eft+C~teit.Finally, the output door portion of the model is to create a hidden stateht from the cell Ct; the expression is
(6)ot=σWoht−1+Uoxt+bo,ht=otetanhCt.The BTC price fitted by LSTM is shown in Figure5, and the gold price fitted by LSTM is shown in Figure 6.Figure 5
LSTM prediction of BTC. LSTM has a high coincidence rate in the trend of fitting curves, but some values still have a large error.Figure 6
LSTM prediction of gold. Compared with BTC price fitting, the fitting result of gold is more in line with experimental expectations, and the curve trend fitting degree is better, and the accuracy is higher.


## 3.1.2. GRU Fit

GRU is a gated recurrent unit, which is simplified on the basis of LSTM. In the GRU model, the memoryht combines long-term memory and short-term memory, and ht contains the past information ht−1 and the present information h~t. The current information is determined by the past information and the current input through the reset gate. The value range of each threshold is 0 to 1. During forward propagation, the value of ht at each moment can be calculated directly by using the memory update formula.
(i)
Reset gatezt=σWz·ht−1,xt(ii)
Update gatert=σWz·ht−1,xt(iii)
Memoryht=1−zi∗ht−1+zt∗h~t(iv)
Candidate hidden layerh~t=tanhW·rt∗ht−1,xtThe BTC price fitted by GRU is shown in Figure7, and the gold price fitted by GRU is shown in Figure 8.Figure 7
GRU prediction of BTC. GRU corrects the hysteresis of LSTM to some extent, making the fitting accuracy more in line with expectations.Figure 8
GRU prediction of gold. As the gold data is relatively stable, the goodness of fit of GRU and LSTM are similar.In summary, by observing each fitting curve, the recurrent neural network can achieve a more accurate fitting for complex data, and accurate fitting is the basis for obtaining the optimal strategy. In this paper, we use the LSTM model and the GRU model to strengthen each other’s accuracy and obtain a very ideal fitting curve, which will be used for future price prediction and income calculation.


## 3.2. Strategy Proposal

At present, there is an accurate price prediction model, and the model recognition strategy based on the recurrent neural network that we have envisaged before can be realized. At the same time, in the exploration of portfolio investment, we also found other simpler investment strategies.In the investment problem, the trading strategy at a certain moment will be determined by the price of the next stage, and for a certain stage in the future (a short period of time), there are only two trends of rising and falling. According to this law, two basic investment strategies that do not rely on forecasts can be proposed. The specific explanation is as follows:(i)
The follow-the-winner inertial investment strategy: according to the change trend in a period of time before this day, it is subjectively believed that the change in a short period of time after should be the same as before, that is, maintain a certain inertia. Therefore, the optimal investment strategy will be determined by the same changing trends as in the previous stage(ii)
The follow-the-loser reversal investment strategy: according to the change trend in a period of time before this day, it is subjectively believed that the change in a short period of time after should be opposite to the previous one, that is, a decision-making method that is completely opposite to the follow-the-winner strategy(iii)
Follow-the-winner: the strategy assumes that there will be inertia in future prices. Future price action will be largely influenced by past inertia. The main representatives are Cover and Ordentlich’s UP algorithm [9] and Helmbold et al.’s EG algorithm [10](iv)
Follow-the-loser: it is expected that security prices will change direction in the future, such as the online reversal investment model proposed by Borodin et al. [12] and Li et al. [11](v)
Strategies based on model identification methods: mine the distribution laws behind the data with the help of algorithms and predict and optimize according to the laws


## 3.3. Optimistic Strategic Argumentation

At present, two other investment strategies have been added, namely, follow-the-winner inertial investment strategy and follow-the-loser reversal investment strategy. At the same time, we also found that the traditional time series ARIMA model can also predict the price to guide the investment strategy. Under these strategies, whether the model identification strategy still has a leading advantage, we will demonstrate one by one next.


## 3.4. Horizontal Comparison: Model Identification versus Two Different Strategies

### 3.4.1. Follow-the-Winner Inertial Investment Strategy Analysis

In this strategy, the optimal investment strategy is determined by following the price inertia of the previous stage. Therefore, in order to avoid the impact of short-term fluctuations in the data on the results, we analyze the price trends of the two assets and use the average volatility of bitcoin and gold prices in the last 5 periods (MA5) as an indicator.(7)MA5=∑i=510xi/5−∑i=05xi/5∑i=05xi/5×100%.Depending onMAi–1 with MAi positive and negative, the model can be divided into two situations, respectively, which correspond to actual buy and sell operations as Table 1.Table 1
Buy sell selection under the follow-the-winner strategy.
ConditionsDecision makingMAi−1<0 and MAi>0BuyMAi<0 and MAi−1>0SellWe consider gold and bitcoin and allocate initial cash of 500 yuan, each with the use of follow-the-winner strategy computational benefits and trading volume, and data and part of the results are presented as Figures9 and 10Figure 9
Gold price chart and earning cash.Figure 10
Bitcoin price chart and earning cash.It can be obtained by calculation from Table2 that in 5 years, when the initial capital of bitcoin and gold is, respectively, invested 500 US dollars, there are 60 buys and 60 sells of bitcoin transactions. In the case of a 98% derating rate, the total income is $1068.703029; in the case of a 99% derating rate for gold, the final income is $663.9566117, and the total income is $1,732.65. The 5-year overall revenue rate is 173.2%, which is in line with expectations.Table 2
Follow-the-winner strategy site result.
Total cashNumber of gold in handBitcoin quantity50000.1494643350000.1494643350000.1494643300.380720320.14946433


### 3.4.2. Follow-the-Loser Reversal Investment Strategy Analysis

The follow-the-loser reversal investment strategy states that future security prices are expected to reverse direction, contrary to previous trends. In the previous paper, we have conducted different analyses on the buying and selling under the follow-the-winner strategy. The results show that when the asset price volatility (volatility is how much the price fluctuates) in the previous stage is negative, and the current price volatility is positive, the winner strategy is more inclined to choose to buy assets to obtain higher returns. When the price volatility of the commodity in the previous stage is positive and the current price volatility is negative, the winner strategy is more inclined to choose to throw the commodity to stop the loss in time. The follow-the-loser strategy is different from this. This strategy believes that when the current currency price fluctuation trend is negative, it proves that there will be a price increase in the future stage, so it chooses the opposite trading option to the winner strategy.From the previous analysis of the price trend of bitcoin and gold, it can be seen that the two assets show an upward trend in prices as a whole. In this case, the reverse operation of the market trend will bring about a large loss, and we will not discuss it again.PS: in the case of the data given by this question, the follow-the-loser reversal investment strategy will bring a lot of losses, but it does not mean that this strategy is incorrect. This strategy will have unique application value in certain security markets where the overall price trend is declining in volatility.


### 3.4.3. Model Comprehensively Identifying Investment Strategies Based on RNN

Consistent with the previous strategy, the gold and bitcoin are separated, each distribution of $500, with gold as an example; the fit results are shown in Table3.Table 3
GRU gold output.
Layer(type)Output shapeParam #gru(GRU)(None,40,80)19920dropout(Dropout)(None,40,80)0gru_1(GRU)(None,100)54600dropout_1(Dropout)(None,100)0dense(Dense)(None,1)101In this result, the total params is 74,621, trainable params is 74,621, and nontrainable params is 0. The mean square error of the obtained model is 358.258737, the root mean square error is 18.927724, and the mean absolute error is 14.040908. The fit is good, and the model results are in line with expectations.It can be obtained by calculation: in 5 years, when the initial capital of bitcoin and gold is, respectively, invested 500 US dollars, there are 60 buys and 60 sells of bitcoin transactions. In the case of a 98% derating rate, the total income is $21721.60873; a total of 80 purchases and 80 sales of gold are carried out, and in the case of a 99% derating rate, $337.974518 is finally recovered, which means a loss of $162.025482. Gross revenue is $22,059.583248; after deducting costs of $1,000, total revenue is $21,059.583248. The 5-year overall rate of return is at 2105.96%.


## 3.4.1. Follow-the-Winner Inertial Investment Strategy Analysis

In this strategy, the optimal investment strategy is determined by following the price inertia of the previous stage. Therefore, in order to avoid the impact of short-term fluctuations in the data on the results, we analyze the price trends of the two assets and use the average volatility of bitcoin and gold prices in the last 5 periods (MA5) as an indicator.(7)MA5=∑i=510xi/5−∑i=05xi/5∑i=05xi/5×100%.Depending onMAi–1 with MAi positive and negative, the model can be divided into two situations, respectively, which correspond to actual buy and sell operations as Table 1.Table 1
Buy sell selection under the follow-the-winner strategy.
ConditionsDecision makingMAi−1<0 and MAi>0BuyMAi<0 and MAi−1>0SellWe consider gold and bitcoin and allocate initial cash of 500 yuan, each with the use of follow-the-winner strategy computational benefits and trading volume, and data and part of the results are presented as Figures9 and 10Figure 9
Gold price chart and earning cash.Figure 10
Bitcoin price chart and earning cash.It can be obtained by calculation from Table2 that in 5 years, when the initial capital of bitcoin and gold is, respectively, invested 500 US dollars, there are 60 buys and 60 sells of bitcoin transactions. In the case of a 98% derating rate, the total income is $1068.703029; in the case of a 99% derating rate for gold, the final income is $663.9566117, and the total income is $1,732.65. The 5-year overall revenue rate is 173.2%, which is in line with expectations.Table 2
Follow-the-winner strategy site result.
Total cashNumber of gold in handBitcoin quantity50000.1494643350000.1494643350000.1494643300.380720320.14946433


## 3.4.2. Follow-the-Loser Reversal Investment Strategy Analysis

The follow-the-loser reversal investment strategy states that future security prices are expected to reverse direction, contrary to previous trends. In the previous paper, we have conducted different analyses on the buying and selling under the follow-the-winner strategy. The results show that when the asset price volatility (volatility is how much the price fluctuates) in the previous stage is negative, and the current price volatility is positive, the winner strategy is more inclined to choose to buy assets to obtain higher returns. When the price volatility of the commodity in the previous stage is positive and the current price volatility is negative, the winner strategy is more inclined to choose to throw the commodity to stop the loss in time. The follow-the-loser strategy is different from this. This strategy believes that when the current currency price fluctuation trend is negative, it proves that there will be a price increase in the future stage, so it chooses the opposite trading option to the winner strategy.From the previous analysis of the price trend of bitcoin and gold, it can be seen that the two assets show an upward trend in prices as a whole. In this case, the reverse operation of the market trend will bring about a large loss, and we will not discuss it again.PS: in the case of the data given by this question, the follow-the-loser reversal investment strategy will bring a lot of losses, but it does not mean that this strategy is incorrect. This strategy will have unique application value in certain security markets where the overall price trend is declining in volatility.


## 3.4.3. Model Comprehensively Identifying Investment Strategies Based on RNN

Consistent with the previous strategy, the gold and bitcoin are separated, each distribution of $500, with gold as an example; the fit results are shown in Table3.Table 3
GRU gold output.
Layer(type)Output shapeParam #gru(GRU)(None,40,80)19920dropout(Dropout)(None,40,80)0gru_1(GRU)(None,100)54600dropout_1(Dropout)(None,100)0dense(Dense)(None,1)101In this result, the total params is 74,621, trainable params is 74,621, and nontrainable params is 0. The mean square error of the obtained model is 358.258737, the root mean square error is 18.927724, and the mean absolute error is 14.040908. The fit is good, and the model results are in line with expectations.It can be obtained by calculation: in 5 years, when the initial capital of bitcoin and gold is, respectively, invested 500 US dollars, there are 60 buys and 60 sells of bitcoin transactions. In the case of a 98% derating rate, the total income is $21721.60873; a total of 80 purchases and 80 sales of gold are carried out, and in the case of a 99% derating rate, $337.974518 is finally recovered, which means a loss of $162.025482. Gross revenue is $22,059.583248; after deducting costs of $1,000, total revenue is $21,059.583248. The 5-year overall rate of return is at 2105.96%.


## 3.5. Vertical Comparison: Comparison between Deep Learning Methods and Traditional Time Series under Model Recognition

### 3.5.1. Traditional Time Series Model ARIMA Fitting Analysis

ARIMA time series is one of the best fitting strategies for financial products and stock market price trends. ARIMA is often used as a common method for model recognition and fitting due to its advantages of flexibility and stability. Therefore, in the price fitting of gold and BTC, if we want to show that the model recognition strategy integrating deep learning is better than that based on the traditional model recognition strategy, we need to compare the accuracy of the fitting results of neural network and the traditional time series ARIMA fitting results and analyze the results.(1) Bitcoin Price Fit under ARIMA(2,1,1). Through the fitting of the price trend of the bitcoin, the ARIMA(2,1,1) model can be obtained. We use the parameters mentioned in Table 4 for time series fitting, and the model parameters are shown in Table 5:Table 4
Notation description in the model. Other unmarked symbols are mainly explained where they appear.
SymbolDescriptionyPredict the outcometYearARIMADifferentially integrated moving average autoregressiveAICAkaike information guidelinesBICInformationADFExpanded Dickey-Fuller testACFAutocorrelation functionsPACFPartial autocorrelation functionR2Goodness of fitTable 5
ARIMA(2,1,1) model parameter table.
ItemSymbolCoefficientStandard errorz valuepvalue95% CICon.c24.86219.8861.250.211-14.115~63.839ARα10.4390.2172.0180.0440.013~0.865α20.1020.0244.14500.054~0.149MAβ1-0.5130.218-2.3550.019-0.940~-0.086AIC value: 29601.258; BIC value: 29628.804.Make the following description for this model:(i)
The information criterion AIC and BIC values are used for multiple analysis model comparisons; the lower the two values, the better. If the analysis is performed multiple times, the changes of the two values can be compared to comprehensively explain the optimization process of the model construction(ii)
The ARIMA model requires the model residuals to be white noise; that is, the residuals have no autocorrelation, which can be tested by the Q statistic test (null hypothesis: the residuals are white noise)(iii)
For example, Q6 is used to test whether the first 6-order autocorrelation coefficient of the residual satisfies white noise. Usually, its correspondingp value is greater than 0.1, which means it meets the white noise test (and vice versa, it is not white noise). In common cases, it can be directly analyzed for Q6(iv)
Rejecting the white noise assumption (p<0.05) means that the model fits poorly; otherwise, it usually means that the model can be used normallyFor value, use the AIC information criterion to model and compare multiple alternative models, and finally find the optimal model: ARIMA(2,1,1). Its formula and Q statistics are shown as follows:(8)yt=24.862+0.439∗yt−1+0.102∗yt−2−0.513∗εt−1.From the Q statistic results, thep value of Q6 is greater than 0.1, then the original hypothesis cannot be rejected at a significant level of 0.1, the residual of the model is white noise, the model is basically satisfied, and absolute error is 536.5997966.(2) Gold Price Fit under ARIMA(4,1,5). The gold price model fitted by time series is shown in Table 6.Table 6
ARIMA(4,1,5) model parameter table.
ItemSymbolCoefficientStandard errorz valuep value95% CIConstantc0.3810.3561.0690.285-0.318~1.080ARα1-0.8390.121-6.9030-1.077~-0.601α20.3860.2951.3070.191-0.193~0.965α3-0.2320.311-0.7450.456-0.842~0.378α4-0.5190.131-3.9750-0.775~-0.263MAβ10.8640.1217.12100.626~1.102β2-0.3330.306-1.0870.277-0.932~0.267β30.2780.3440.8070.42-0.397~0.953β40.3870.1672.3130.0210.059~0.714β5-0.1560.033-4.6520-0.221~-0.090AIC value: 10132.380; BIC value: 10188.855.For USD (PM), combined with AIC information guidelines for modeling and comparison, it is finally identified as ARMA(4, 1, 5); its formula and Q statistic show as follows:(9)yt=0.381−0.839∗yt−1+0.386∗yt−2−0.232∗yt−3−0.519∗yt−4+0.864∗εt−1−0.333∗εt−2+0.278∗εt−3+0.387∗εt−4−0.156∗εt−5.According to the results of Table7 of Q statistics, when the p value of Q6 is greater than 0.1 m, the original hypothesis cannot be rejected at the significant level of 0.1. The residual of the model is white noise, the model basically meets the requirements, and the absolute error is 0.006059449.Table 7
Model Q statistics in ARIMA(2,1,1) and ARIMA(4,1,5).
ItemStatisticsp valueItemStatisticsp valueQ600.992Q60.0020.964Q120.8460.991Q124.4730.613Q1849.2590.000∗∗Q1811.0860.522Q2454.6940.000∗∗Q2415.0150.661Q3096.3370.000∗∗Q3025.8950.359(3) ARIMA Time Series Fit Conclusion. From the above results, the effect of using ARIMA time series for the price trend of bitcoin is poor, and the absolute error can reach 536. For the price trend of gold, the fit is better, and the absolute error is only about 0.006.The reason for this is diversity, and the most important of all is that the prices of the two assets do not fluctuate freely with the market but involve many factors. The traditional time series are only based on statistical principles and cannot accurately predict the data itself. Therefore, the ARIMA prediction model has poor stability and poor effect.


### 3.5.2. Model Comparative Conclusion

In fact, several different strategies are only as good as forecasting the overall price movement of the asset. Comparing the three results, it can be found that the GRU model is better than the other two in overall performance, for three main reasons:(i)
The first two models cannot know the future trend of asset prices on the day because they do not rely on the prediction of the trend. Therefore, the selection of strategies cannot be optimal(ii)
Although the final benefit of the follow-the-winner strategy is not as good as the fitting effect of the GRU in the recurrent neural network, this is not the gap caused by the model itself, but due to the superiority of the GRU model in prediction, after sample training. The predicted data is generally similar to the real data, especially after standardization or normalization, and the order of magnitude of this gap will be further reduced(iii)
Compared with GRU model, the other two strategies have stronger interpretability and weaker hysteresisIn practice, we should consider these three strategies, rather than simply do deep learning algorithm fitting analysis. For the actual quantitative investment, due to historical limitations, we cannot accurately predict whether the future price trend is rising or falling. Therefore, follow-the-winner inertia investment strategy and follow-the-loser reversal investment strategy still have practical application value.When we analyze the three strategies in Figure11, we also roughly consider the application environment of each strategy. It is shown as follows; when the data show the characteristics as shown in the figure, this strategy will have application value.Figure 11
Different strategic selections under different data trends. Follow-the-winner is more suitable for use when the overall price fluctuation shows an upward trend, follow-the-loser is more suitable for use when the overall price fluctuation is in a downward trend, and the model recognition method integrated with deep learning is more suitable for price curve fluctuation under different circumstances.


## 3.5.1. Traditional Time Series Model ARIMA Fitting Analysis

ARIMA time series is one of the best fitting strategies for financial products and stock market price trends. ARIMA is often used as a common method for model recognition and fitting due to its advantages of flexibility and stability. Therefore, in the price fitting of gold and BTC, if we want to show that the model recognition strategy integrating deep learning is better than that based on the traditional model recognition strategy, we need to compare the accuracy of the fitting results of neural network and the traditional time series ARIMA fitting results and analyze the results.(1) Bitcoin Price Fit under ARIMA(2,1,1). Through the fitting of the price trend of the bitcoin, the ARIMA(2,1,1) model can be obtained. We use the parameters mentioned in Table 4 for time series fitting, and the model parameters are shown in Table 5:Table 4
Notation description in the model. Other unmarked symbols are mainly explained where they appear.
SymbolDescriptionyPredict the outcometYearARIMADifferentially integrated moving average autoregressiveAICAkaike information guidelinesBICInformationADFExpanded Dickey-Fuller testACFAutocorrelation functionsPACFPartial autocorrelation functionR2Goodness of fitTable 5
ARIMA(2,1,1) model parameter table.
ItemSymbolCoefficientStandard errorz valuepvalue95% CICon.c24.86219.8861.250.211-14.115~63.839ARα10.4390.2172.0180.0440.013~0.865α20.1020.0244.14500.054~0.149MAβ1-0.5130.218-2.3550.019-0.940~-0.086AIC value: 29601.258; BIC value: 29628.804.Make the following description for this model:(i)
The information criterion AIC and BIC values are used for multiple analysis model comparisons; the lower the two values, the better. If the analysis is performed multiple times, the changes of the two values can be compared to comprehensively explain the optimization process of the model construction(ii)
The ARIMA model requires the model residuals to be white noise; that is, the residuals have no autocorrelation, which can be tested by the Q statistic test (null hypothesis: the residuals are white noise)(iii)
For example, Q6 is used to test whether the first 6-order autocorrelation coefficient of the residual satisfies white noise. Usually, its correspondingp value is greater than 0.1, which means it meets the white noise test (and vice versa, it is not white noise). In common cases, it can be directly analyzed for Q6(iv)
Rejecting the white noise assumption (p<0.05) means that the model fits poorly; otherwise, it usually means that the model can be used normallyFor value, use the AIC information criterion to model and compare multiple alternative models, and finally find the optimal model: ARIMA(2,1,1). Its formula and Q statistics are shown as follows:(8)yt=24.862+0.439∗yt−1+0.102∗yt−2−0.513∗εt−1.From the Q statistic results, thep value of Q6 is greater than 0.1, then the original hypothesis cannot be rejected at a significant level of 0.1, the residual of the model is white noise, the model is basically satisfied, and absolute error is 536.5997966.(2) Gold Price Fit under ARIMA(4,1,5). The gold price model fitted by time series is shown in Table 6.Table 6
ARIMA(4,1,5) model parameter table.
ItemSymbolCoefficientStandard errorz valuep value95% CIConstantc0.3810.3561.0690.285-0.318~1.080ARα1-0.8390.121-6.9030-1.077~-0.601α20.3860.2951.3070.191-0.193~0.965α3-0.2320.311-0.7450.456-0.842~0.378α4-0.5190.131-3.9750-0.775~-0.263MAβ10.8640.1217.12100.626~1.102β2-0.3330.306-1.0870.277-0.932~0.267β30.2780.3440.8070.42-0.397~0.953β40.3870.1672.3130.0210.059~0.714β5-0.1560.033-4.6520-0.221~-0.090AIC value: 10132.380; BIC value: 10188.855.For USD (PM), combined with AIC information guidelines for modeling and comparison, it is finally identified as ARMA(4, 1, 5); its formula and Q statistic show as follows:(9)yt=0.381−0.839∗yt−1+0.386∗yt−2−0.232∗yt−3−0.519∗yt−4+0.864∗εt−1−0.333∗εt−2+0.278∗εt−3+0.387∗εt−4−0.156∗εt−5.According to the results of Table7 of Q statistics, when the p value of Q6 is greater than 0.1 m, the original hypothesis cannot be rejected at the significant level of 0.1. The residual of the model is white noise, the model basically meets the requirements, and the absolute error is 0.006059449.Table 7
Model Q statistics in ARIMA(2,1,1) and ARIMA(4,1,5).
ItemStatisticsp valueItemStatisticsp valueQ600.992Q60.0020.964Q120.8460.991Q124.4730.613Q1849.2590.000∗∗Q1811.0860.522Q2454.6940.000∗∗Q2415.0150.661Q3096.3370.000∗∗Q3025.8950.359(3) ARIMA Time Series Fit Conclusion. From the above results, the effect of using ARIMA time series for the price trend of bitcoin is poor, and the absolute error can reach 536. For the price trend of gold, the fit is better, and the absolute error is only about 0.006.The reason for this is diversity, and the most important of all is that the prices of the two assets do not fluctuate freely with the market but involve many factors. The traditional time series are only based on statistical principles and cannot accurately predict the data itself. Therefore, the ARIMA prediction model has poor stability and poor effect.


## 3.5.2. Model Comparative Conclusion

In fact, several different strategies are only as good as forecasting the overall price movement of the asset. Comparing the three results, it can be found that the GRU model is better than the other two in overall performance, for three main reasons:(i)
The first two models cannot know the future trend of asset prices on the day because they do not rely on the prediction of the trend. Therefore, the selection of strategies cannot be optimal(ii)
Although the final benefit of the follow-the-winner strategy is not as good as the fitting effect of the GRU in the recurrent neural network, this is not the gap caused by the model itself, but due to the superiority of the GRU model in prediction, after sample training. The predicted data is generally similar to the real data, especially after standardization or normalization, and the order of magnitude of this gap will be further reduced(iii)
Compared with GRU model, the other two strategies have stronger interpretability and weaker hysteresisIn practice, we should consider these three strategies, rather than simply do deep learning algorithm fitting analysis. For the actual quantitative investment, due to historical limitations, we cannot accurately predict whether the future price trend is rising or falling. Therefore, follow-the-winner inertia investment strategy and follow-the-loser reversal investment strategy still have practical application value.When we analyze the three strategies in Figure11, we also roughly consider the application environment of each strategy. It is shown as follows; when the data show the characteristics as shown in the figure, this strategy will have application value.Figure 11
Different strategic selections under different data trends. Follow-the-winner is more suitable for use when the overall price fluctuation shows an upward trend, follow-the-loser is more suitable for use when the overall price fluctuation is in a downward trend, and the model recognition method integrated with deep learning is more suitable for price curve fluctuation under different circumstances.


## 3.6. Strength and Weakness

This paper does not directly analyze and fit the amount of cash, bitcoin, and gold as neural network parameters but considers the case where $1,000 is divided into two equally and invests in bitcoin and gold, respectively. The benefits of doing this are as follows:(i)
It is convenient to consider the handling fee problem in the transaction process, and it is easy to change the handling fee ratio, so as to realize the sensitivity analysis of the model parameters(ii)
By considering the portfolio investment recommendations under different model states, it can be strongly demonstrated from multiple perspectives that the dominant position of deep learning in quantitative trading(iii)
The model is more realistic and has stronger generality and stability. Through independent analysis of different investment portfolios, the model can be applied to quantitative investment transactions in different fields and can be easily migrated to any eligible quantitative trading scenario for useHowever, there are still some shortcomings in the model:(i)
The issue of the coexistence of risks and returns is not considered. In a more real quantitative trading venue, risk is an important factor that coexists with returns(ii)
The extreme conditions of the market are not considered. In fact, special economic conditions are more common in economic transactions, and the research conditions of this paper are ideal


## 4. Model Test

### 4.1. Sensitive Analysis

A robust model needs to be able to adapt to different environments. We simulate different financial products by setting different transaction costs, or traders are in different countries or regions. This can prove the robustness of the whole model more strongly.In order to make the model more general and better able to migrate to different transaction scenarios, we adopt the transaction fee strategy in the changing transaction for the model. Take bitcoin as an example, expand the derating rate of bitcoin from the original 2% to 7%, and observe the model.The conclusion shown in Figure12 that when the parameters change to 7%, the optimal strategy for bitcoin trading is still to conduct 60 buy and sell operations. And the specific performance in the transaction process is slightly different, which is reflected in the different time nodes of buying and selling assets. The model obtained through 7% fee fitting finally obtained a profit of $20,613.36339 through bitcoin. Compared with the original income result of $21,721.60873, it can be observed that the model shows better sensitivity.Figure 12
The real price and holdings of bitcoin under the condition of 7% handling fee.


### 4.2. Stability Analysis

We adjust the trading loss parameters of the model from 1%, 2%, to 7%, and the results show that the model still has very good sensitivity under large parameter changes. Moreover, the model has strong adaptability in different occasions and can be easily migrated to different quantitative investment scenarios.Therefore, it can be considered that the model shows good stability. Whether it is the price of gold or the price of bitcoin, although they fluctuate with the date, after the double fitting comparison of LSTM/GRU, and through the use of the “follow-the-winner” strategy on the overall trend for auxiliary analysis, it is found that the model has both strong interpretability and high fitting rate in many cases.


## 4.1. Sensitive Analysis

A robust model needs to be able to adapt to different environments. We simulate different financial products by setting different transaction costs, or traders are in different countries or regions. This can prove the robustness of the whole model more strongly.In order to make the model more general and better able to migrate to different transaction scenarios, we adopt the transaction fee strategy in the changing transaction for the model. Take bitcoin as an example, expand the derating rate of bitcoin from the original 2% to 7%, and observe the model.The conclusion shown in Figure12 that when the parameters change to 7%, the optimal strategy for bitcoin trading is still to conduct 60 buy and sell operations. And the specific performance in the transaction process is slightly different, which is reflected in the different time nodes of buying and selling assets. The model obtained through 7% fee fitting finally obtained a profit of $20,613.36339 through bitcoin. Compared with the original income result of $21,721.60873, it can be observed that the model shows better sensitivity.Figure 12
The real price and holdings of bitcoin under the condition of 7% handling fee.


## 4.2. Stability Analysis

We adjust the trading loss parameters of the model from 1%, 2%, to 7%, and the results show that the model still has very good sensitivity under large parameter changes. Moreover, the model has strong adaptability in different occasions and can be easily migrated to different quantitative investment scenarios.Therefore, it can be considered that the model shows good stability. Whether it is the price of gold or the price of bitcoin, although they fluctuate with the date, after the double fitting comparison of LSTM/GRU, and through the use of the “follow-the-winner” strategy on the overall trend for auxiliary analysis, it is found that the model has both strong interpretability and high fitting rate in many cases.


## 5. Conclusion

This paper focuses on model recognition strategy based on deep learning in quantitative investment trading. Firstly, the effectiveness of follow-the-winner and follow-the-loser strategies is obtained through horizontal comparison, and the specific benefits are obtained to demonstrate. Secondly, through longitudinal comparison, it is concluded that the traditional time series model has poor fitting effect compared with deep learning in model recognition. Through the accuracy verification and principle analysis of two different implementation methods, it is found that the model recognition strategy using deep learning strategy is optimal in several cases compared in this paper.


### 5.1. Price Fitting Model

Further, in the deep learning (based on LSTM/GRU) model recognition problem, we can further classify. There are two strategies for fitting asset price trends:(i)
Integrate and fit a variety of assets, and train deep learning networks with obvious time series characteristics such as LSTM/GRU as a whole, and use dropout and other means to reduce overfitting(ii)
Fit different asset types separately, train LSTM/GRU and other deep learning networks with obvious time series characteristics, and use dropout and other means to reduce overfitting. Finally, a comprehensive analysis is carried out according to the principle of portfolio investmentIn the latter case, we divide the model into three strategies:(i)
Follow-the-winner inertial investment strategy(ii)
Follow-the-loser reversal investment strategy(iii)
Model comprehensively identifying investment strategies


### 5.2. The Best Understanding of Different Strategies

For the overall trend of the data, we obtain through the analysis of the strategy: follow-the-winner strategy can be selected for the overall upward trend of volatility to achieve the maximum profit; follow-the-loser strategy can be selected for the overall downward trend to avoid losses. If the overall trend of the model is unknown or does not have an overall trend of change in a certain direction, whether it is ARIMA traditional time series model algorithm, follow-the-winner strategy, or follow-the-loser strategy, it is far less effective than the comprehensive recognition strategies of models such as LSTM or GRU in the deep learning algorithm.


### 5.3. Further Work

This paper innovatively proposes a model recognition investment strategy based on LSTM/GRU method and demonstrates the superiority of this strategy. However, the method in this paper still has shortcomings: the model recognition strategy based on deep learning method can be further strengthened by backtracking algorithm, and the neural network parameters can be modified more accurately. In addition, the neural network unit gate structure dedicated to financial derivatives can be introduced for more targeted optimization and conclusion analysis.As a strategy, model recognition has a variety of implementation methods. In this paper, the effectiveness of the new method is demonstrated by comparing the deep learning method with the time series analysis in the traditional model recognition method.In the future, more suitable methods may be applied to model recognition strategies. It is worth noting that all implementation methods are responses to strategies. There may be differences between methods, but their core ideas remain unchanged.


## 5.1. Price Fitting Model

Further, in the deep learning (based on LSTM/GRU) model recognition problem, we can further classify. There are two strategies for fitting asset price trends:(i)
Integrate and fit a variety of assets, and train deep learning networks with obvious time series characteristics such as LSTM/GRU as a whole, and use dropout and other means to reduce overfitting(ii)
Fit different asset types separately, train LSTM/GRU and other deep learning networks with obvious time series characteristics, and use dropout and other means to reduce overfitting. Finally, a comprehensive analysis is carried out according to the principle of portfolio investmentIn the latter case, we divide the model into three strategies:(i)
Follow-the-winner inertial investment strategy(ii)
Follow-the-loser reversal investment strategy(iii)
Model comprehensively identifying investment strategies


## 5.2. The Best Understanding of Different Strategies

For the overall trend of the data, we obtain through the analysis of the strategy: follow-the-winner strategy can be selected for the overall upward trend of volatility to achieve the maximum profit; follow-the-loser strategy can be selected for the overall downward trend to avoid losses. If the overall trend of the model is unknown or does not have an overall trend of change in a certain direction, whether it is ARIMA traditional time series model algorithm, follow-the-winner strategy, or follow-the-loser strategy, it is far less effective than the comprehensive recognition strategies of models such as LSTM or GRU in the deep learning algorithm.


## 5.3. Further Work

This paper innovatively proposes a model recognition investment strategy based on LSTM/GRU method and demonstrates the superiority of this strategy. However, the method in this paper still has shortcomings: the model recognition strategy based on deep learning method can be further strengthened by backtracking algorithm, and the neural network parameters can be modified more accurately. In addition, the neural network unit gate structure dedicated to financial derivatives can be introduced for more targeted optimization and conclusion analysis.As a strategy, model recognition has a variety of implementation methods. In this paper, the effectiveness of the new method is demonstrated by comparing the deep learning method with the time series analysis in the traditional model recognition method.In the future, more suitable methods may be applied to model recognition strategies. It is worth noting that all implementation methods are responses to strategies. There may be differences between methods, but their core ideas remain unchanged.



---

*Source: 8856215-2022-09-01.xml*