1. Introduction
Cryptocurrency is a digital asset based on blockchain. Bitcoin, the first kind of cryptocurrency, was invented by Satoshi Nakamoto in 2009 [1]. Cryptocurrency experienced exaggerated development since 2015 and has gained considerable attention from the financial market as an emergent financial product [2]. After a bubble burst in early 2018, the industry boomed and expanded in 2020 owing to the pandemic, and its performance was promising but unstable in 2021 [2]. Until June 2024, there are approximately 10,037 categories of cryptocurrencies in the market, compared to 66 categories in 2013 [3]. With an annually increasing rate of 8.62% from 2024-2028, the total market revenue is expected to achieve an amount of US$51.5bn in 2024 and US$71.7bn by 2028 [4]. Contemporarily, Bitcoin (BTC) is the most valuable cryptocurrency, followed by Ethereum (ETH) and Litecoin (LTC) [2]. Also, Bitcoin dominates the cryptocurrency market with around 50% capitalization proportion [5]. Essentially, cryptocurrencies are tokens utilized in blockchain networks, symbols of value to conduct transactions. Blockchain, performing as a distributed ledger, records objects with intrinsic value, including financial transactions. Cryptocurrencies possess several advantages with the assistance of blockchain technology, including immutability, decentralization, and transparency, acting as decentralized mediums of exchange to realize financial transactions cryptographically.
Because of its distinct features compared to other financial products, cryptocurrency-related assets are regarded as profitable, universally considered, and even incorporated into portfolios and trading strategies by asset and hedge funds managers, especially in current years. As cryptocurrency trading continues to rise in popularity, it has captured the interest of scholars, thereby establishing itself as a burgeoning research area within financial trading. The advancement of Artificial Intelligence (AI) algorithms has further fueled this trend, leading to an increasing number of research papers exploring the application of machine learning models to predict cryptocurrency returns.
Machine learning techniques build algorithms that are capable of updating themselves by locating patterns from existing data spontaneously without explicit outer directions. Various categories of machine learning algorithms are commonly employed for prediction tasks, including classification (such as Naive Bayes (NB), Support Vector Machine (SVM), K-Nearest Neighbor (KNN), Decision Tree, Random Forest (RF), and Gradient Boosting), clustering (e.g., K-Means), and regression (like Linear Regression and Scatterplot Smoothing). Deep learning models, including Convolutional Neural Network (CNN), Recurrent Neural Network (RNN), Gated Recurrent Unit (GRU), Multilayer Perceptron (MLP), and Long Short-Term Memory (LSTM), are also widely used. Additionally, reinforcement learning techniques like Deep Q-Learning and Deep Boltzmann Machine are utilized for these predictions. In research, above categories of algorithms are extensively mingled, forming hybrid research models to be more adjustable to the impacting factors from the complicated cryptocurrency transaction environment. Nakano et al. looked into Bitcoin intraday trading with artificial neural networks (ANNs), an algorithm of deep learning, to predict the price trend in the next dealing period. With applications of tens of indicators in their experiment, the over-fitting characteristic of the prediction model was less pronounced. Sun et al. applied RFs to catch characteristics from past data, predicting cryptocurrency price trends, concluding that the accuracy is positively connected with the data amount. Meanwhile, Vo and Yost-Bremm compared the performance of RFs and deep learning models in cryptocurrency high-frequency trading (HFT).
Slepaczuk and Zenkova's study on SVM models aimed to distinguish cryptocurrencies with varying returns, but they discovered that SVM's tendency to overfit stems from its requirement for numerous indicators. Barnwal et al. integrated generative and discriminative classifiers with a neural network to enhance price direction prediction. Attanasio et al. conducted a comparison of classification algorithms such as SVM, NB, and RF for forecasting next-day price trends, finding that hybrid methods are more effective than single algorithms. Zhengyang et al. implemented ANN and LSTM models, noting that ANN generally performs better than LSTM. Kwon et al.'s use of an LSTM model incorporating a three-dimensional price tensor demonstrated that LSTM is more adept at classifying cryptocurrencies with high volatility compared to the Gradient Boosting (GB) model. Alessandretti et al. evaluated gradient-boosting decision trees and LSTM models, finding that decision trees provide higher accuracy for short-term predictions (5 to 10 days), whereas LSTM is superior for long-term data (50 days). Phaladisailoed and Numnonda's comparison of models, including LSTM and GRU, revealed that GRU is the most accurate. Persson et al. developed a novel hybrid model by comparing vector autoregressive models with RNNs, successfully merging the advantages of both techniques [2].
Therefore, this study aims to examine two popular machine learning algorithms, LSTM and GRU. By introducing, analyzing, and comparing their performances in predicting the prices of mainstream cryptocurrencies, this paper aims to provide a window for investors and financial companies to know more about potential machine learning algorithms or models that can be applied to cryptocurrency return prediction, assisting them in accomplishing informed investment decisions with emergent AI techniques.
2. Methodology
2.1. Data Description
The purpose of this study is to study the LSTM model's prediction of cryptocurrency return rate. To do this, we collected two datasets covering a wide time span. The following is a detailed description of the dataset. The data set used in this study is time series data, mainly derived from official statistics published by finance [3]. The dataset contains nearly two years of K-line data for Bitcoin and Ethereum. The sample covers the daily opening, high, low and close prices. This dataset has high reliability and validity of its data as a mainstream cryptocurrency exchange in the world. At the same time, we conducted a preliminary examination of the data and found no obvious outliers or missing values. However, due to the limitation of the data source, some of the data may have some degree of error or bias, which will be taken into account in the subsequent analysis. With a detailed description of the dataset, we can see that the dataset has a broad time span and contains several key economic indicators. This will provide vital data support for the subsequent empirical analysis. We will use this data to investigate the LSTM model's prediction of cryptocurrency returns further.
2.2. Methods
Reinforcement learning techniques like deep reinforcement learning have been utilized for cryptocurrency trading. These algorithms bypass traditional prediction approaches and directly optimize trading actions to maximize cumulative profits. For instance, the influence of user actions and sentiment analysis on cryptocurrency prices is analyzed by a neural network system developed from deep learning techniques. Researchers have demonstrated that these factors possess predictive power in forecasting cryptocurrency prices by analyzing GitHub comments, Google research, Twitter posts, and sentiment metrics. Among these machine learning techniques, deep learning models, particularly LSTM have emerged as powerful tools for predicting cryptocurrency returns. LSTM-based reinforcement learning models have achieved impressive results, outperforming other deep learning models in extreme market situations. LSTM models are widely employed in financial time series forecasting, notably for predicting cryptocurrency prices. These models are frequently paired with other deep learning techniques, such as CNN, to achieve impressive outcomes in identifying intricate patterns and dependencies within cryptocurrency data. An example of this synergy is the CNN-LSTM model, which allows for highly accurate predictions of cryptocurrency price movements.
In addition to LSTM models, several other popular models have been employed for cryptocurrency price prediction. Autoregressive Integrated Moving Average Model (ARIMA) models are widely used in time series analysis and have been applied to forecast cryptocurrency prices. These models capture the autocorrelation and trend in the data, making them suitable for short-term price predictions. Developed by Facebook's Core Data Science team, Prophet is a robust time series forecasting model. It incorporates seasonality, trend changes, and holidays, making it useful for cryptocurrency price prediction. Random Forest algorithms, an ensemble learning technique, have been employed for cryptocurrency price prediction. These models combine multiple decision trees to make predictions and have shown good performance in capturing complex relationships in the data. GB models, such as XGBoost and LightGBM, are powerful machine-learning algorithms for cryptocurrency price prediction. They sequentially build an ensemble of weak prediction models to create a robust predictive model. SVM is a supervised learning model for cryptocurrency price prediction. SVMs aim to find an optimal hyperplane that separates different classes in the data, making them suitable for binary classification tasks. RNN models, similar to LSTM, effectively handle sequential data. They have been applied to cryptocurrency price prediction tasks, capturing temporal dependencies in the data. Gaussian Process (GP) models are probabilistic models for cryptocurrency price prediction. They provide a flexible framework for modeling uncertainty and making predictions based on Bayesian inference. These models, alongside LSTM, offer a diverse set of approaches for cryptocurrency price prediction, each with its strengths and applicability to different datasets and research objectives.
2.2.1. LSTM Model for Cryptocurrency Return Prediction
The LSTM model is composed of multiple "gate" structures, including input gates, output gates, and forgetting gates, as well as memory cells [6]. These structures determine what information should be forgotten and what information should be added to the model. The model's output is generated by considering both the stored information and the current input data [7]. The LSTM model is trained using historical cryptocurrency data as inputs, with the cryptocurrency performance reports serving as the target outputs [8]. Throughout the training process, the algorithm continuously fine-tunes the model parameters to reduce the discrepancy between predicted and actual values, thereby optimizing performance. Use a trained LSTM model to make predictions about new, previously unseen cryptocurrency data. The forecast results are then compared with actual data to assess the accuracy of the forecast results. The diagrammatic figure is shown in the Figure 1.
Figure 1: LSTM diagrammatic figure
2.2.2. GRU Model
GRUs are a type of RNN. When predicting the returns of cryptocurrencies, GRUs can obtain long-term dependencies from time series data, thus enhancing predictive accuracy. GRUs function through three fundamental gating mechanisms, including the reset gate, the update gate, and the output gate. The reset gate defines the degree of association between the current input and previous states; the update gate regulates the speed of information updating; the output gate decides the composition of the final output. Such gating mechanisms empower GRUs to flexibly remember or ignore data, adapting to the rapidly changing characteristics of the cryptocurrency market [9]. The pipeline is shown in Figure 2.
Figure 2: The pipeline of GRU
3. Results and Discussions
3.1. The Application of LSTM
The prediction of cryptocurrency returns by AI is an area of high interest for investors. However, due to the problems of gradient disappearance and gradient explosion in traditional RNN networks when dealing with long timing problems, it is a difficult task to deal with cryptocurrency prices using traditional RNN networks. Therefore, LSTM introduces three gates to solve this problem compared to the traditional RNN model. The research conducted by Zhao et al. focuses on the performance improvement of LSTM models compared to traditional RNN models for dealing with long time series problems, such as cryptocurrency return prediction. As shown in Table 1, RNN, LSTM, MRNNF50, and MLSTMF50 models were comprehensively reviewed from four aspects: accuracy, precision, recall rate, and cellos [10]. It can see that with MLSTMF50 as the first layer, all metrics on top of the LSTM are significantly improved. To achieve optimal performance, the MRNNF50 demonstrates the highest accuracy. In contrast, the MLSTMF50 outperforms in all other metrics, showing a clear advantage across various performance indicators. Compared with the traditional RNN model, the LSTM model has been significantly improved in all aspects of performance after introducing the concept of gate.
Table 1: The performance in terms of accuracy (ac), precision (p), recall (re), and cross-entropy loss (CEloss).
ac | p | re | CEloss | |
RNN | 0.2836(0.0348) | 0.1786(0.0606) | 0.2248(0.0350) | 1.5787(0.0348) |
LSTM | 0.3021(0.0468) | 0.1724(0.0697) | 0.2274(0.0332) | 1.5752(0.0189) |
MRNNF50 | 0.3096(0.0373) | 0.1692(0.0839) | 0.2223(0.0428) | 1.5704(0.0328) |
MLSTMF50 | 0.3110(0.0204) | 0.2254(0.0707) | 0.2594(0.0262) | 1.4758(0.0218) |
3.2. The Application of GRU
In practical applications, a GRU model first requires a large amount of historical price data as input. Then, the model learns patterns and trends in these data through training. Once trained, the GRU can predict the return of cryptocurrencies at a future point in time. In our study, we developed three distinct machine-learning algorithms to forecast the prices of BTC, ETH, and LTC. To assess the accuracy of these algorithms, the research employed Root Mean Squared Error (RMSE) and Mean Absolute Percentage Error (MAPE) as evaluation metrics [9]. The algorithm achieving the lowest values in these metrics was deemed the most effective. Subsequently, we compared the actual prices with the predicted ones. Our findings revealed that the GRU model achieved MAPE values of 0.2454% for BTC, 0.8267% for ETH, and 0.2116% for LTC. Additionally, the GRU model outperformed the other algorithms, yielding RMSE values of 174.129 for BTC, 26.59 for ETH, and 0.825 for LTC [11]. Based on these results, the GRU model emerged as the most efficient and reliable for cryptocurrency price prediction.
The AI algorithms demonstrated robustness and reliability in predicting cryptocurrency prices. Among them, the GRU model proved to be superior to both LSTM and bi-LSTM models, showcasing excellent predictive performance across all evaluated cryptocurrencies. Although the performance of GRU is the best in this experiment, there are still some inevitable disadvantages of it we need to discuss. First is about its generalization ability, which means that in some cases, GRUs may not capture complex sequence dependencies as effectively as LSTMs, especially when dealing with the highly complex cryptocurrency market. Second is its model complexity. Although GRU has fewer parameters than LSTM, its gating mechanism adds complexity to the model, which can make it sensitive to hyperparameters and require careful tuning for optimal performance.
4. Conclusion
This study has presented a comprehensive analysis of LSTM and GRU models for predicting cryptocurrency returns, addressing a key area of interest in the field of financial analytics. The research involved a detailed introduction to the data used, comprising historical cryptocurrency prices, and an overview of the methodologies employed to train and evaluate the models. By comparing the structural intricacies and performance metrics of LSTM and GRU, we have highlighted their respective strengths and limitations. LSTM models, with their ability to capture long-term dependencies, exhibited higher accuracy, precision, and recall rates, as well as lower cross-entropy losses. This suggests their robustness in identifying patterns within the volatile cryptocurrency market. On the other hand, GRU models, known for their simpler architecture and faster training times, outperformed traditional machine learning algorithms by achieving lower RMSE and MAPE values, indicating their efficiency in handling time-series data with fewer computational resources. In terms of application, both models have shown promising potential, yet they are not without their drawbacks. The complexity of LSTM models can lead to longer training times and higher computational costs, making them less suitable for real-time applications. GRU models, while faster, may not capture long-term dependencies as effectively as LSTM models, which can be a limitation in markets with prolonged trends.
Future research should focus on hybrid approaches that combine the strengths of both LSTM and GRU models, along with the integration of other advanced machine learning techniques, to further enhance predictive accuracy and efficiency. Additionally, exploring the application of these models in different market conditions and incorporating external factors such as market sentiment and macroeconomic indicators could provide deeper insights and improve the robustness of predictions. Overall, this study contributes valuable knowledge to the field of cryptocurrency return prediction, offering practical implications for investors and traders. By continuously refining these models and expanding their applications, we can move towards more reliable and sophisticated financial forecasting tools that can better navigate the complexities of the cryptocurrency market.
Authors Contribution
All the authors contributed equally and their names were listed in alphabetical order.
References
[1]. Lee, D. K. C., Guo, L., & Wang, Y. (2018). Cryptocurrency: A new investment opportunity?. Journal of Alternative Investments, 20(3), 16.
[2]. Fang, F., Ventre, C., Basios, M., Kanthan, L., Martinez-Rego, D., Wu, F., & Li, L. (2022). Cryptocurrency trading: a comprehensive survey. Financial Innovation, 8(1), 13.
[3]. Statista, K. (2024). Quantity of cryptocurrencies as of June 3. Retrieved from https://www.statista.com/statistics/863917/number-crypto-coins-tokens/
[4]. Statista, K. (2024). Cryptocurrencies - Worldwide | Statista market forecast. Retrieved from https://www.statista.com/outlook/fmo/digital-assets/cryptocurrencies/worldwide
[5]. Coin, G. (2024). Global Cryptocurrency Market Cap Charts. Retrieved from https://www.coingecko.com/en/global-charts
[6]. Yu, Y., Si, X., Hu, C., & Zhang, J. (2019). A review of recurrent neural networks: LSTM cells and network architectures. Neural computation, 31(7), 1235-1270.
[7]. Staudemeyer, R. C., & Morris, E. R. (2019). Understanding LSTM--a tutorial into long short-term memory recurrent neural networks. arXiv preprint arXiv:1909.09586.
[8]. Sherstinsky, A. (2020). Fundamentals of recurrent neural network (RNN) and long short-term memory (LSTM) network. Physica D: Nonlinear Phenomena, 404, 132306.
[9]. Hamayel, M. J., & Owda, A. Y. (2021). A novel cryptocurrency price prediction model using GRU, LSTM and bi-LSTM machine learning algorithms. Ai, 2(4), 477-496.
[10]. Zhao, J., Huang, F., Lv, J., Duan, Y., Qin, Z., Li, G., & Tian, G. (2020). Do RNN and LSTM have long memory?. In International Conference on Machine Learning, 11365-1137.
[11]. Koszewski, K., Mazumdar, S., & Kumar, A. S. (2024). Understanding rate of return dynamics of cryptocurrencies: an experimental campaign. Artificial Intelligence Review, 57(1), 8.
Cite this article
Guo,K.;Yan,H.;Zou,P. (2024). Application and Analysis of LSTM and GRU Models for Cryptocurrency Return Prediction. Advances in Economics, Management and Political Sciences,99,54-60.
Data availability
The datasets used and/or analyzed during the current study will be available from the authors upon reasonable request.
Disclaimer/Publisher's Note
The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of EWA Publishing and/or the editor(s). EWA Publishing and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
About volume
Volume title: Proceedings of ICFTBA 2024 Workshop: Finance in the Age of Environmental Risks and Sustainability
© 2024 by the author(s). Licensee EWA Publishing, Oxford, UK. This article is an open access article distributed under the terms and
conditions of the Creative Commons Attribution (CC BY) license. Authors who
publish this series agree to the following terms:
1. Authors retain copyright and grant the series right of first publication with the work simultaneously licensed under a Creative Commons
Attribution License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this
series.
2. Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the series's published
version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial
publication in this series.
3. Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and
during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See
Open access policy for details).
References
[1]. Lee, D. K. C., Guo, L., & Wang, Y. (2018). Cryptocurrency: A new investment opportunity?. Journal of Alternative Investments, 20(3), 16.
[2]. Fang, F., Ventre, C., Basios, M., Kanthan, L., Martinez-Rego, D., Wu, F., & Li, L. (2022). Cryptocurrency trading: a comprehensive survey. Financial Innovation, 8(1), 13.
[3]. Statista, K. (2024). Quantity of cryptocurrencies as of June 3. Retrieved from https://www.statista.com/statistics/863917/number-crypto-coins-tokens/
[4]. Statista, K. (2024). Cryptocurrencies - Worldwide | Statista market forecast. Retrieved from https://www.statista.com/outlook/fmo/digital-assets/cryptocurrencies/worldwide
[5]. Coin, G. (2024). Global Cryptocurrency Market Cap Charts. Retrieved from https://www.coingecko.com/en/global-charts
[6]. Yu, Y., Si, X., Hu, C., & Zhang, J. (2019). A review of recurrent neural networks: LSTM cells and network architectures. Neural computation, 31(7), 1235-1270.
[7]. Staudemeyer, R. C., & Morris, E. R. (2019). Understanding LSTM--a tutorial into long short-term memory recurrent neural networks. arXiv preprint arXiv:1909.09586.
[8]. Sherstinsky, A. (2020). Fundamentals of recurrent neural network (RNN) and long short-term memory (LSTM) network. Physica D: Nonlinear Phenomena, 404, 132306.
[9]. Hamayel, M. J., & Owda, A. Y. (2021). A novel cryptocurrency price prediction model using GRU, LSTM and bi-LSTM machine learning algorithms. Ai, 2(4), 477-496.
[10]. Zhao, J., Huang, F., Lv, J., Duan, Y., Qin, Z., Li, G., & Tian, G. (2020). Do RNN and LSTM have long memory?. In International Conference on Machine Learning, 11365-1137.
[11]. Koszewski, K., Mazumdar, S., & Kumar, A. S. (2024). Understanding rate of return dynamics of cryptocurrencies: an experimental campaign. Artificial Intelligence Review, 57(1), 8.