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.

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.

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 laws

This 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 Figure 2.

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 Figure 3. However, data preprocessing and sample training must be performed before operation with traditional statistical rules.

Avoid the influence of the scale and standardize the data. It is assumed that there is to evaluate objects, evaluating indicators, and the matrix and its standardized matrix are where each element in is .

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 Figure 4. In the model, each sequence index position will be propagated forward at time . In addition to the same hidden state as the general recurrent neural network, there is an additional hidden state. The hidden state is called the cell state (Cell State), and essentially plays the role of the hidden layer state 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 generally includes a forget gate, an input gate, and an output gate. The basic structural units are as follows:

The Forcer Door is responsible for control whether or not to forget the hidden cell state of the previous layer; the expression is

is called a sigmoid activation function. Since the value of is between [0, 1], it represents the probability of forgetting the status of the previous layer. When new variables and want to predict the next word, we hope to go to the last variable some of the features of .

The input door is responsible for controlling whether the current time input variable incorporates cell state; the expression is

In the formula, represents the probability of remembering this layer input information. The information needs to be added by the current cell status by and . The result of the former cell state and the input door will act on the current cell state ; the expression is

Finally, the output door portion of the model is to create a hidden state from the cell ; the expression is

The BTC price fitted by LSTM is shown in Figure 5, and the gold price fitted by LSTM is shown in Figure 6.

3.1.2. GRU Fit

GRU is a gated recurrent unit, which is simplified on the basis of LSTM. In the GRU model, the memory combines long-term memory and short-term memory, and contains the past information and the present information . 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 at each moment can be calculated directly by using the memory update formula. (i)Reset gate (ii)Update gate (iii)Memory (iv)Candidate hidden layer

The BTC price fitted by GRU is shown in Figure 7, and the gold price fitted by GRU is shown in Figure 8.

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.

Depending on with positive and negative, the model can be divided into two situations, respectively, which correspond to actual buy and sell operations as Table 1.

We 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 Figures 9 and 10

It can be obtained by calculation from Table 2 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.

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 Table 3.

In 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:

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 corresponding 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 () means that the model fits poorly; otherwise, it usually means that the model can be used normally

For 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:

From the Q statistic results, the 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.

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:

According to the results of Table 7 of Q statistics, when the 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.

(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 hysteresis

In 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 Figure 11, 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.

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 use

However, 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 Figure 12 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.

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 investment

In 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.

Data Availability

The data in the paper are from 2022 MCM/ICM Problems C: Trading Strategies. The data is true and reliable, and the data used to support the findings of this study are included within the article.

Conflicts of Interest

The authors declare that they have no conflicts of interest.