Analysis and Forecasting of Cryptocurrency Markets Using Bayesian and LSTM-Based Deep Learning Models
Abstract
1. Introduction
2. Literature Review
3. Methodology
3.1. Data Collection
3.2. Data Preprocessing
3.3. Bayesian State-Space Model
3.4. Model Formulation of Bayesian State-Space Model
- is the latent state at time t, representing the underlying Bitcoin price process.
- is the previous latent state.
- is the feature vector at time .
- represents the feature coefficients.
- Seasonality accounts for periodic fluctuations in price patterns.
- is the latent state noise, drawn from a half-normal prior distribution to enforce non-negativity.
- is the observed Bitcoin closing price at time t.
- is the latent state obtained from the transition model.
- is the observation noise, modeled using half-normal prior to control variance.
- A Student’s t-distribution with 4 degrees of freedom is chosen instead of a Gaussian likelihood to ensure robustness against extreme price fluctuations (outliers).
- Bayesian State-Space Model (AR1) Sampling Process MCMC with NUTS
- Define the Posterior Distribution
- x are the latent states.
- includes process noise, observation noise, regression coefficients and seasonal components.
- Hamiltonian Monte Carlo Framework
- Potential Energy: , derived from the posterior distribution.
- Kinetic Energy: , based on the auxiliary momentum variable r.
- Leapfrog Integration
- Acceptance Step (Metropolis–Hastings Criterion)
- A new sample is accepted with probability:
- If (where ), accept ; otherwise, retain x.
3.5. LSTM Neural Network Model
- Model Formulation of LSTM Neural Network
- LSTM Layer Computation
- are the forget, input, and output gates,
- are the cell and hidden states,
- u is the number of LSTM units,
- is the sigmoid activation function,
- ⊙ denotes elementwise multiplication.
- Dropout Regularization
- Stacked LSTM Layers
- Output Layer
- Loss Function
- LSTM Memory Cell Architecture
3.6. Evaluation Metrics
4. Results
4.1. Results of Bayesian State-Space Modeling for Cryptocurrency Forecasting
4.2. Model Evaluation for Bayesian State-Space Model
Mean | Median | Lower CI (2.5%) | Upper CI (97.5%) |
0.025452 | 0.025454 | 0.022458 | 0.028671 |
Mean | Median | Lower CI (2.5%) | Upper CI (97.5%) |
0.006369 | 0.006584 | 0.003147 | 0.009534 |
4.3. Results of LSTM for Cryptocurrency Forecasting
4.4. Summary of Model Performance
4.5. Correlating Matrix
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Vora, G. Cryptocurrencies: Are Disruptive Financial Innovations Here? Mod. Econ. 2015, 6, 816–832. [Google Scholar] [CrossRef]
- Almagsoosi, L.; Abadi, M.; Hasan, H.F.; Sharaf, H. Effect of the Volatility of the Crypto Currency and Its Effect on the Market Returns. Ind. Eng. Manag. Syst. 2022, 21, 238–243. [Google Scholar] [CrossRef]
- Ahmed, M.S.; El-Masry, A.A.; Al-Maghyereh, A.I.; Kumar, S. Cryptocurrency Volatility: A Review, Synthesis, and Research Agenda. Res. Int. Bus. Financ. 2024, 71, 102472. [Google Scholar] [CrossRef]
- Brini, A.; Lenz, J. A Comparison of Cryptocurrency Volatility—Benchmarking New and Mature Asset Classes. Financ. Innov. 2024, 10, 122. [Google Scholar] [CrossRef]
- Habib, G.; Sharma, S.; Ibrahim, S.; Ahmad, I.; Qureshi, S.; Ishfaq, M. Blockchain Technology: Benefits, Challenges, Applications, and Integration of Blockchain Technology with Cloud Computing. Future Internet 2022, 14, 341. [Google Scholar] [CrossRef]
- Xu, M.; Chen, X.; Kou, G. A Systematic Review of Blockchain. Financ. Innov. 2019, 5, 27. [Google Scholar] [CrossRef]
- Panda, S.K.; Sathya, A.R.; Das, S. Bitcoin: Beginning of the Cryptocurrency Era. In Recent Advances in Blockchain Technology: Real-World Applications; Panda, S.K., Sathya, A.R., Das, S., Eds.; Lecture Notes in Networks and Systems; Springer: Cham, Switzerland, 2023; Volume 560, pp. 11–23. [Google Scholar] [CrossRef]
- Fatima, S.S.W.; Rahimi, A. A Review of Time-Series Forecasting Algorithms for Industrial Manufacturing Systems. Machines 2024, 12, 380. [Google Scholar] [CrossRef]
- Alaminos, D.; Salas, M.B.; Partal-Ureña, A. Hybrid ARMA-GARCH-Neural Networks for Intraday Strategy Exploration in High-Frequency Trading. Pattern Recognit. 2024, 148, 110139. [Google Scholar] [CrossRef]
- Seabe, P.L.; Moutsinga, C.R.B.; Pindza, E. Forecasting Cryptocurrency Prices Using LSTM, GRU, and Bi-Directional LSTM: A Deep Learning Approach. Fractal Fract. 2023, 7, 203. [Google Scholar] [CrossRef]
- Khedr, A.; Arif, I.; P V, P.; El-Bannany, M.; Alhashmi, M.; Sreedharan, M. Cryptocurrency Price Prediction Using Traditional Statistical and Machine-Learning Techniques: A Survey. Intell. Syst. Account. Financ. Manag. 2021, 28, 3–34. [Google Scholar] [CrossRef]
- Beck, J. Bayesian System Identification Based on Probability Logic. Struct. Control Health Monit. 2010, 17, 825–847. [Google Scholar] [CrossRef]
- Kaplan, D. On the Quantification of Model Uncertainty: A Bayesian Perspective. Psychometrika 2021, 86, 215–238. [Google Scholar] [CrossRef]
- Singh, V.; Sahana, S.K.; Bhattacharjee, V. A Novel CNN-GRU-LSTM Based Deep Learning Model for Accurate Traffic Prediction. Discov. Comput. 2025, 28, 38. [Google Scholar] [CrossRef]
- Gupta, P.; Malik, S.; Apoorb, K.; Sameer, S.; Vardhan, V.; Ragam, P. Stock Market Analysis Using Long Short-Term Model. ICST Trans. Scalable Inf. Syst. 2023, 11, 2. [Google Scholar] [CrossRef]
- Yahoo Finance. Bitcoin USD (BTC-USD) Stock Price, News, Quote & History. Available online: https://finance.yahoo.com/quote/BTC-USD/ (accessed on 15 April 2025).
- Hua, Y.; Zhao, Z.; Li, R.; Chen, X.; Liu, Z.; Zhang, H. Deep Learning with Long Short-Term Memory for Time Series Prediction. IEEE Commun. Mag. 2019, 57, 114–119. [Google Scholar] [CrossRef]
- Suleman, M.A.R.; Shridevi, S. Short-Term Weather Forecasting Using Spatial Feature Attention Based LSTM Model. IEEE Access 2022, 10, 82456–82468. [Google Scholar] [CrossRef]
- Teye, M.; Azizpour, H.; Smith, K. Bayesian Uncertainty Estimation for Batch Normalized Deep Networks. arXiv 2018, arXiv:1802.06455. [Google Scholar] [CrossRef]
- Kervancı, H.; Akay, D.; Özceylan, E. Bitcoin price prediction using LSTM, GRU and hybrid LSTM-GRU with Bayesian optimization, random search, and grid search for the next days. J. Ind. Manag. Optim. 2023, 20, 570–588. [Google Scholar] [CrossRef]
- Ante, L. How Elon Musk’s Twitter activity moves cryptocurrency markets. Financ. Res. Lett. 2021, 38, 101539. [Google Scholar] [CrossRef]
- Pandey, T.D. Impact of Musk’s Remarks on Volatility of Bitcoin and Dogecoin Amid COVID-19 Pandemic. J. Digit. Econ. 2024, 3, 85–102. [Google Scholar] [CrossRef]
- Huynh, T.L.D. When Elon Musk Changes His Tone, Does Bitcoin Adjust Its Tune? Comput. Econ. 2023, 62, 639–661. [Google Scholar] [CrossRef]
- Seabe, P.L.; Moutsinga, C.R.B.; Pindza, E. Sentiment-Driven Cryptocurrency Forecasting: Analyzing LSTM, GRU, Bi-LSTM, and Temporal Attention Model (TAM). Soc. Netw. Anal. Min. 2025, 15, 52. [Google Scholar] [CrossRef]
- Kavitha, K.; Gopi, K.; Saicharan, K.; Tharun, K.; Abhinay, K. Cryptocurrency Price Forecasting with Sentiment-Driven Alerts Using ML. Int. J. Innov. Res. Sci. Eng. Technol. 2025, 14, 9280–9287. [Google Scholar]
- Kabo, I.G.; Obunadike, G.N.; Samaila, N.A. Sentiment-Driven and Economic Indicators for Bitcoin Price Forecasting: A Hybrid Time Series Model. J. Sci. Res. Rev. 2025, 2, 99–107. [Google Scholar] [CrossRef]
- Wen, C.; Wu, X.; Shen, C.; Huang, Z.; Cai, P. Bitcoin Price Prediction Based on Sentiment Analysis and LSTM. Appl. Comput. Eng. 2023, 29, 148–159. [Google Scholar] [CrossRef]
- Hamayel, M.J.; Owda, A.Y. A Novel Cryptocurrency Price Prediction Model Using GRU, LSTM and bi-LSTM Machine Learning Algorithms. AI 2021, 2, 477–496. [Google Scholar] [CrossRef]
- Tripathi, B.; Sharma, R.K. Modeling Bitcoin Prices Using Signal Processing Methods, Bayesian Optimization, and Deep Neural Networks. Comput. Econ. 2023, 62, 1919–1945. [Google Scholar] [CrossRef]
- Ghosh, P.M. Customer Conversion Prediction with Markov Chain Classifier. 2015. Available online: https://pkghosh.wordpress.com/2015/07/06/customer-conversion-prediction-with-markov-chain-classifier/ (accessed on 17 August 2025).
- Amunategui, M. Markov Chains—Seeing the Future. 2015. Available online: https://amunategui.github.io/markov-chains/index.html (accessed on 17 August 2025).
- Muhammad, M.; Abba, B. A Bayesian Inference with Hamiltonian Monte Carlo (HMC) Framework for a Three-Parameter Model with Reliability Applications. Kuwait J. Sci. 2025, 52, 100365. [Google Scholar] [CrossRef]
- Noomene, R. Procedures of Parameters’ Estimation of AR(1) Models into Linear State-Space Models. In Proceedings of the World Congress on Engineering 2007 (WCE 2007), London, UK, 2–4 July 2007; Volume II; Lecture Notes in Engineering and Computer Science. Newswood Limited: Hong Kong, China, 2007. [Google Scholar]
- Cao, Y.; Tufto, J. Bayesian Inference with tmbstan for a State-Space Model with VAR(1) State Equation. arXiv 2021, arXiv:2101.05635. [Google Scholar] [CrossRef]
- Zhang, T.; Zhao, S.; Luan, X.; Liu, F. Bayesian Inference for State-Space Models With Student-t Mixture Distributions. IEEE Trans. Cybern. 2023, 53, 4435–4445. [Google Scholar] [CrossRef]
- Yuan, K.; Girolami, M.; Niranjan, M. Markov Chain Monte Carlo Methods for State-Space Models with Point Process Observations. Neural Comput. 2012, 24, 1462–1486. [Google Scholar] [CrossRef] [PubMed]
- Bernardo, J. Reference Posterior Distributions for Bayesian Inference. J. R. Stat. Soc. Ser. B (Methodol.) 1979, 41, 113–147. [Google Scholar] [CrossRef]
- Ghislieri, M.; Cerone, G.L.; Knaflitz, M.; Agostini, V. Long Short-Term Memory (LSTM) Recurrent Neural Network for Muscle Activity Detection. J. Neuroeng. Rehabil. 2021, 18, 153. [Google Scholar] [CrossRef]
- Van Houdt, G.; Mosquera, C.; Nápoles, G. A Review on the Long Short-Term Memory Model. Artif. Intell. Rev. 2020, 53, 5929–5955. [Google Scholar] [CrossRef]
- ElMoaqet, H.; Eid, M.; Glos, M.; Ryalat, M.; Penzel, T. Deep Recurrent Neural Networks for Automatic Detection of Sleep Apnea from Single Channel Respiration Signals. Sensors 2020, 20, 5037. [Google Scholar] [CrossRef]
- Yadav, H.; Thakkar, A. NOA-LSTM: An Efficient LSTM Cell Architecture for Time Series Forecasting. Expert Syst. Appl. 2024, 238, 122333. [Google Scholar] [CrossRef]
- Chai, T.; Draxler, R. Root Mean Square Error (RMSE) or Mean Absolute Error (MAE)? Arguments Against Avoiding RMSE in the Literature. Geosci. Model Dev. 2014, 7, 1247–1250. [Google Scholar] [CrossRef]
- Hodson, T. Root-Mean-Square Error (RMSE) or Mean Absolute Error (MAE): When to Use Them or Not. Geosci. Model Dev. 2022, 15, 5481–5487. [Google Scholar] [CrossRef]
Column | Non-Null Count | Data Type |
---|---|---|
Close | 836 | float64 |
High | 836 | float64 |
Low | 836 | float64 |
Open | 836 | float64 |
Volume | 836 | int64 |
Weekly_Return | 829 | float64 |
Monthly_Return | 806 | float64 |
SMA_7 | 830 | float64 |
SMA_30 | 807 | float64 |
Attributes | Type | Description |
---|---|---|
Close | Continuous | Closing price of the asset for the trading day. |
High | Continuous | Highest price of the asset during the trading day. |
Low | Continuous | Lowest price of the asset during the trading day. |
Open | Continuous | The opening price of the asset at the start of the trading day. |
Volume | Continuous | Total number of shares/units traded during the day. |
Weekly_Return | Continuous | Percentage return of the asset over the past week. |
Monthly_Return | Continuous | Percentage return of the asset over the past month. |
SMA_7 | Continuous | 7-day Simple Moving Average of the closing price. |
SMA_30 | Continuous | 30-day Simple Moving Average of the closing price. |
Close gap | Continuous | The gap between the current day’s close and the previous day’s close. |
High gap | Continuous | The gap between the current day’s high and the previous day’s high. |
Low gap | Continuous | The gap between the current day’s low and the previous day’s low. |
Volume gap | Continuous | Gap between the current day’s trading volume and the previous day’s volume. |
Daily change | Continuous | Absolute or percentage change in price from open to close. |
Next day direction | Categorical | Binary indicator (0/1) for whether the next day’s price increased or decreased. |
Volume gap lmh | Categorical | Categorized volume gap as low (L), medium (M), or high (H). |
Daily change lmh | Categorical | Categorized daily change as low (L), medium (M), or high (H). |
Layer (Type) | Output Shape | Param # |
---|---|---|
LSTM (lstm) | (None, 1, 60) | 16,800 |
Dropout (dropout) | (None, 1, 60) | 0 |
LSTM (lstm_1) | (None, 1, 120) | 86,880 |
Dropout (dropout_1) | (None, 1, 120) | 0 |
LSTM (lstm_2) | (None, 1, 120) | 115,680 |
Dropout (dropout_2) | (None, 1, 120) | 0 |
LSTM (lstm_3) | (None, 120) | 115,680 |
Dropout (dropout_3) | (None, 120) | 0 |
Dense (dense) | (None, 1) | 121 |
Total params: | 335,161 (1.28 MB) | |
Trainable params: | 335,161 (1.28 MB) | |
Non-trainable params: | 0 (0.00 B) |
Beta Coefficient | Mean | Median | Lower CI (2.5%) | Upper CI (97.5%) |
---|---|---|---|---|
0 | 0.033250 | 0.031372 | −0.025999 | 0.090184 |
1 | 0.053356 | 0.052167 | 0.009508 | 0.100368 |
2 | −0.020745 | −0.018536 | −0.179973 | 0.135351 |
3 | 0.006551 | 0.006268 | −0.034640 | 0.048365 |
4 | 0.004011 | 0.003931 | −0.001295 | 0.009155 |
5 | 0.002178 | 0.001892 | −0.008642 | 0.014365 |
6 | −0.017455 | −0.016412 | −0.175080 | 0.144590 |
7 | −0.013722 | −0.012798 | −0.045134 | 0.015407 |
8 | 0.000599 | −0.000107 | −0.028292 | 0.031358 |
Model | MSE (Train) | MAE (Train) | MSE (Test) | MAE (Test) |
---|---|---|---|---|
Bayesian State-Space | 0.0000 | 0.0026 | 0.0013 | 0.0307 |
LSTM | 0.0004 | 0.0160 | 0.0007 | 0.0212 |
Feature | Correlation | Feature | Correlation |
---|---|---|---|
Log_Close | 1.000000 | SMA_30 | 0.938578 |
Close | 0.990731 | Volume | 0.469081 |
High | 0.988440 | Monthly_Return | 0.140036 |
Low | 0.986819 | Weekly_Return | 0.048678 |
Open | 0.984017 | High gap | 0.029021 |
Close_Lag_1 | 0.984007 | Close gap | 0.024964 |
SMA_7 | 0.979808 | Volume gap | 0.024654 |
Close_Lag_2 | 0.978520 | Daily change | 0.024446 |
Close_Lag_3 | 0.972631 | Low gap | 0.014126 |
volume gap lmh | −0.004228 | ||
Next day direction | −0.009155 | ||
daily change lmh | −0.014753 |
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 MDPI and/or the editor(s). MDPI 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. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Biki, B.B.; Sakamoto, M.; Takei, A.; Alam, M.J.; Riajuliislam, M.; Showaibuzzaman, S. Analysis and Forecasting of Cryptocurrency Markets Using Bayesian and LSTM-Based Deep Learning Models. Informatics 2025, 12, 87. https://doi.org/10.3390/informatics12030087
Biki BB, Sakamoto M, Takei A, Alam MJ, Riajuliislam M, Showaibuzzaman S. Analysis and Forecasting of Cryptocurrency Markets Using Bayesian and LSTM-Based Deep Learning Models. Informatics. 2025; 12(3):87. https://doi.org/10.3390/informatics12030087
Chicago/Turabian StyleBiki, Bidesh Biswas, Makoto Sakamoto, Amane Takei, Md. Jubirul Alam, Md. Riajuliislam, and Showaibuzzaman Showaibuzzaman. 2025. "Analysis and Forecasting of Cryptocurrency Markets Using Bayesian and LSTM-Based Deep Learning Models" Informatics 12, no. 3: 87. https://doi.org/10.3390/informatics12030087
APA StyleBiki, B. B., Sakamoto, M., Takei, A., Alam, M. J., Riajuliislam, M., & Showaibuzzaman, S. (2025). Analysis and Forecasting of Cryptocurrency Markets Using Bayesian and LSTM-Based Deep Learning Models. Informatics, 12(3), 87. https://doi.org/10.3390/informatics12030087