Hybrid BiLSTM-ARIMA Architecture with Whale-Driven Optimization for Financial Time Series Forecasting
Abstract
1. Introduction
2. Data Description
2.1. Data Source
2.2. Cointegration Tests
3. Methods
3.1. ARIMA
3.2. BiLTM
3.3. WOA
| Algorithm 1. Whale optimization algorithm (WOA) |
| Input: Objective function , population size , maximum iterations Max Output: Best solution and its fitness |
| 1: Initialize the whale population 2: Evaluate the fitness of each whale f(x) 3: Identify the best solution 4: For to do: 5: For each whale = 1 to : 6: Calculate parameter 7: Generate random numbers and in [0, 1] 8: Compute 9: Compute 10: Generate in [0, 1] 11: If then 12: If then 13: Compute 14: Update 15: Else 16: Choose randomly from the population 17: Compute 18: Update 19: Else 20: Compute 21: Generate in [−1, 1] 22: Set (a constant, typically = 1) 23: Update 24: Update fitness of all whales 25: Update if a better solution is found 26: Return and |
3.4. WOA-BiLSTM-ARIMA Hybrid Model
3.5. Evaluation Metrics
4. Experiment
4.1. Experimental Settings
4.2. Data Processing
4.3. Optimizing Network Parameters by the WOA
4.4. Results and Analysis
4.5. Walk-Forward Validation
4.6. Backtesting Experiment
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Alsharef, A.; Aggarwal, K.; Sonia; Kumar, M.; Mishra, A. Review of ML and AutoML solutions to forecast time-series data. Arch. Comput. Methods Eng. 2022, 29, 5297–5311. [Google Scholar] [CrossRef]
- Yang, Y. Research on financial investment risk assessment techniques and applications. Sci. Technol. Soc. Dev. Proc. Ser. 2024, 2, 117–123. [Google Scholar] [CrossRef]
- Huang, S.; An, H.; Gao, X.; Hao, X.; Huang, X. The multiscale conformation evolution of the financial time series. Math. Probl. Eng. 2015, 2015, 563145. [Google Scholar] [CrossRef]
- Usmani, U.A.; Aziz, I.A.; Jaafar, J.; Watada, J. Deep learning for anomaly detection in time-series data: An analysis of techniques, review of applications, and guidelines for future research. IEEE Access 2024, 12, 174564–174590. [Google Scholar] [CrossRef]
- Box, G.E.P.; Jenkins, G.M.; Reinsel, G.C.; Ljung, G.M. Time Series Analysis: Forecasting and Control, 5th ed.; John Wiley Sons: Hoboken, NJ, USA, 2015. [Google Scholar]
- Bollerslev, T. Generalized autoregressive conditional heteroskedasticity. J. Econom. 1986, 31, 307–327. [Google Scholar] [CrossRef]
- Virtanen, I.; Yli-Olli, P. Forecasting stock market prices in a thin security market. Omega 1987, 15, 145–155. [Google Scholar] [CrossRef]
- Alkamali, A. Bitcoin Short-Term Price Prediction Using Time Series Analysis; Rochester Institute of Technology: Rochester, NY, USA, 2024. [Google Scholar]
- Li, J. Research on risk hedging strategy of SSE 50ETF options based on GARCH model. Econ. Issues 2023, 45, 68–75. [Google Scholar]
- Karanam, R.K.; Natakam, V.M.; Boinapalli, N.R.; Sridharlakshmi, N.R.B.; Allam, A.R.; Gade, P.K.; Manikyala, A. Neural networks in algorithmic trading for financial markets. Asian Account. Audit. Adv. 2018, 9, 115–126. [Google Scholar]
- Kim, K.J. Financial time series forecasting using support vector machines. Neurocomputing 2003, 55, 307–319. [Google Scholar] [CrossRef]
- Zhang, C.; Zhong, H.; Hu, A. Research on early warning of financial crisis of listed companies based on random forest and time series. Mob. Inf. Syst. 2022, 2022, 1573966. [Google Scholar] [CrossRef]
- Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
- Banerjee, T.; Sinha, S.; Choudhury, P. Long term and short term forecasting of horticultural produce based on the LSTM network model. Appl. Intell. 2022, 52, 9117–9147. [Google Scholar] [CrossRef]
- Sako, K.; Mpinda, B.N.; Rodrigues, P.C. Neural networks for financial time series forecasting. Entropy 2022, 24, 657. [Google Scholar] [CrossRef]
- Benidis, K.; Rangapuram, S.S.; Flunkert, V.; Wang, Y.; Maddix, D.; Turkmen, C.; Januschowski, T. Deep learning for time series forecasting: Tutorial and literature survey. ACM Comput. Surv. 2022, 55, 1–36. [Google Scholar] [CrossRef]
- Zhang, Y.A.; Yan, B.; Aasma, M. A novel deep learning framework: Prediction and analysis of financial time series using CEEMD and LSTM. Expert Syst. Appl. 2020, 159, 113609. [Google Scholar] [CrossRef]
- He, K.; Yang, Q.; Ji, L.; Pan, J.; Zou, Y. Financial time series forecasting with the deep learning ensemble model. Mathematics 2023, 11, 1054. [Google Scholar] [CrossRef]
- Song, X.; Chen, Z.S. Enhancing financial time series forecasting in the shipping market: A hybrid approach with Light Gradient Boosting Machine. Eng. Appl. Artif. Intell. 2024, 136, 108942. [Google Scholar] [CrossRef]
- Liu, T.; Li, J.; Zhang, Z.; Yu, H.; Gao, S. FD-GRNet: A dendritic-driven GRU framework for advanced stock market prediction. IEEE Access 2025, 13, 60321–60332. [Google Scholar] [CrossRef]
- Singh, U.; Saurabh, K.; Trehan, N.; Vyas, R.; Vyas, O.P. GA-LSTM: Performance Optimization of LSTM driven Time Series Forecasting. Comput. Econ. 2024, 64, 1–36. [Google Scholar] [CrossRef]
- Tang, X.; Song, Y.; Jiao, X.; Sun, Y. On forecasting realized volatility for bitcoin based on deep learning PSO–GRU model. Comput. Econ. 2024, 63, 2011–2033. [Google Scholar] [CrossRef]
- Mirjalili, S.; Lewis, A. The whale optimization algorithm. Adv. Eng. Softw. 2016, 95, 51–67. [Google Scholar] [CrossRef]
- Karbuz, S.; Jumah, A. Cointegration and commodity arbitrage. Agribusiness 1995, 11, 235–243. [Google Scholar] [CrossRef]
- Dickey, D.A.; Fuller, W.A. Distribution of the estimators for autoregressive time series with a unit root. J. Am. Stat. Assoc. 1979, 74, 427–431. [Google Scholar]
- Engle, R.F.; Granger, C.W. Co-integration and error correction: Representation, estimation, and testing. Econometrica 1987, 55, 251–276. [Google Scholar] [CrossRef]
- Graves, A.; Graves, A. Long short-term memory. Supervised Seq. Label. Recurr. Neural Netw. 2012, 385, 37–45. [Google Scholar]
- Zhang, S.; Zheng, D.; Hu, X.; Yang, M. Bidirectional long short-term memory networks for relation classification. In Proceedings of the 29th Pacific Asia Conference on Language, Information and Computation, Shanghai, China, 30 October–1 November 2015; pp. 73–78. [Google Scholar]
- Davydovskyi, Y.; Reva, O.; Malyeyeva, O.; Kosenko, V. Application of the sliding window mechanism in simulation of computer network loading parameters. Adv. Inf. Syst. 2020, 4, 16–22. [Google Scholar] [CrossRef]
- Kilichev, D.; Kim, W. Hyperparameter optimization for 1D-CNN-based network intrusion detection using GA and PSO. Mathematics 2023, 11, 3724. [Google Scholar] [CrossRef]
- Ulutas, H.; Günay, R.B.; Sahin, M.E. Detecting diabetes in an ensemble model using a unique PSO-GWO hybrid approach to hyperparameter optimization. Neural Comput. Appl. 2024, 36, 18313–18341. [Google Scholar] [CrossRef]
- Giacomini, R.; White, H. Tests of conditional predictive ability. Econometrica 2006, 74, 1545–1578. [Google Scholar] [CrossRef]









| Data Feature | Indicator |
|---|---|
| X1 | Closing Price |
| X2 | Opening Price |
| X3 | Highest Price |
| X4 | Lowest Price |
| X5 | Moving Average Convergence Divergence (MACD) |
| X6 | Difference (DIF) |
| X7 | Differential Exponential Average (DEA) |
| X8 | Real Price Fluctuation |
| Order | Series | ADF Test Statistic | Critical Value | p-Value | Stationarity | |||
|---|---|---|---|---|---|---|---|---|
| 1% | 5% | 10% | ||||||
| Zero | RB | Close | −1.835 | −3.431 | −2.682 | −2.567 | 0.363 | no |
| HC | Close | −1.763 | 0.412 | no | ||||
| One | RB | Close | −47.471 | −3.431 | −2.682 | −2.567 | 0.000 | yes |
| HC | Close | −47.748 | 0.000 | yes | ||||
| Residual | ADF Test Statistic | Critical Value | p-Value | Stationarity | ||
|---|---|---|---|---|---|---|
| 1% | 5% | 10% | ||||
| μ | −5.621 | −3.431 | −2.862 | −2.567 | 0.000 | yes |
| Series | ADF Test Statistic | Critical Value | p-Value | Stationarity | ||
|---|---|---|---|---|---|---|
| 1% | 5% | 10% | ||||
| Close | −5.506 | −3.431 | −2.862 | −2.567 | 0.000 | yes |
| Name | Configuration Information |
|---|---|
| Operating system | Ubuntu 20.04.2 |
| Programming language | Python 3.7.0 |
| Framework | TensorFlow 2.5.0 + cuda 11.2.2 |
| Key software packages | Pmdarima 1.8.0, Statsmodels 0.13.2, Numpy 1.21.6 |
| CPU | Intel(R) Xeon(R) W-2225 CPU @ 4.10 GHz |
| GPU | NVIDIA RTX A6000 (51 GB) |
| Memory | 263 GB |
| Parameter | Search Range | Optimal Value |
|---|---|---|
| Number of neurons in the first layer of BiLSTM | [1, 500] | 462 |
| Number of neurons in the second layer of BiLSTM | [1, 500] | 214 |
| Number of neurons in the third layer of BiLSTM | [1, 500] | 270 |
| Learning rate | [0.00001, 0.0005] | 0.0004 |
| Dropout rate of the second layer | [0.01, 0.9] | 0.7712 |
| Dropout rate of the third layer | [0.01, 0.9] | 0.3356 |
| Epoch | [1, 500] | 428 |
| Model | MSE | MAE | MAPE |
|---|---|---|---|
| BP | 10.7005 | 2.6118 | 3.4529% |
| RNN | 9.0299 | 2.2936 | 3.7891% |
| LSTM | 7.3952 | 2.0171 | 2.9431% |
| GRU | 7.9237 | 1.9694 | 2.8069% |
| Transformer | 6.7999 | 1.9087 | 2.8738% |
| WOA-BiLSTM-ARIMA | 5.8141 | 1.7097 | 2.2301% |
| Model | MSE | MAE | MAPE |
|---|---|---|---|
| ARIMA | 7.5961 | 2.3605 | 3.1273% |
| BiLSTM | 6.8977 | 1.8568 | 2.9124% |
| WOA-BiLSTM | 6.5556 | 1.8043 | 2.7328% |
| BiLSTM-ARIMA | 6.3493 | 1.7544 | 2.5832% |
| WOA-BiLSTM-ARIMA | 5.8141 | 1.7097 | 2.2301% |
| Compare Model | P | GWstat |
|---|---|---|
| BP vs. Base | 2.16 × 10−186 | 153.8471 |
| RNN vs. Base | 6.21 × 10−170 | 153.6385 |
| LSTM vs. Base | 4.36 × 10−162 | 138.9683 |
| GRU vs. Base | 2.37 × 10−158 | 140.3954 |
| Transformer vs. Base | 2.79 × 10−41 | 138.3965 |
| BiLSTM vs. Base | 6.08 × 10−161 | 132.6079 |
| ARIMA vs. Base | 3.76 × 10−169 | 102.3917 |
| WOA-BiLSTM vs. Base | 4.28 × 10−48 | 20.5941 |
| BiLSTM-ARIMA vs. Base | 1.06 × 10−25 | 10.4884 |
| Fold | Training Period | Testing Period | MSE | MAE | MAPE |
|---|---|---|---|---|---|
| 1 | 2014-09 to 2021-01 | 2022-01 to 2022-07 | 6.4452 | 1.8738 | 6.58% |
| 2 | 2014-09 to 2022-07 | 2022-07 to 2023-01 | 5.3846 | 1.6128 | 2.01% |
| 3 | 2014-09 to 2023-01 | 2023-01 to 2023-07 | 4.8637 | 1.5781 | 1.19% |
| 4 | 2014-09 to 2023-07 | 2023-07 to 2024-01 | 5.7472 | 1.6753 | 1.68% |
| 5 | 2014-09 to 2024-01 | 2024-01 to 2024-07 | 4.2137 | 1.2694 | 1.08% |
| Indictor | R-Breaker | R-Breaker-WB | R-Breaker-WBA |
|---|---|---|---|
| Initial capital | 50,000 | 50,000 | 50,000 |
| Ending capital | 58,450.6 | 75,849.6 | 102,846.7 |
| Total profit/loss | 8450.6 | 25,849.6 | 52,846.7 |
| Average profit/loss | 43.3 | 311.5 | 89.3 |
| Return rate | 16.9% | 51.7% | 105.7% |
| Annualized return rate | 3.38% | 10.34% | 21.14% |
| Total number of trades | 195 | 102 | 429 |
| Total number of profitable trades | 112 | 65 | 256 |
| Average profit | 198.5 | 905.3 | 692.4 |
| Maximum profit | 1008.3 | 4201.6 | 5923.8 |
| Number of losing trades | 83 | 37 | 173 |
| Average loss | −162.4 | −534.8 | −702.1 |
| Maximum loss | −1236.7 | −2311.9 | −4917.2 |
| Maximum drawdown ratio | 0.62% | 1.29% | 1.76% |
| Maximum drawdown amount | 310.4 | 645.27 | 1427.8 |
| Sharpe ratio | −0.74 | 0.43 | 0.88 |
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
Qin, P.; Ye, B.; Li, Y.; Cai, Z.; Gao, Z.; Qi, H.; Ding, Y. Hybrid BiLSTM-ARIMA Architecture with Whale-Driven Optimization for Financial Time Series Forecasting. Algorithms 2025, 18, 517. https://doi.org/10.3390/a18080517
Qin P, Ye B, Li Y, Cai Z, Gao Z, Qi H, Ding Y. Hybrid BiLSTM-ARIMA Architecture with Whale-Driven Optimization for Financial Time Series Forecasting. Algorithms. 2025; 18(8):517. https://doi.org/10.3390/a18080517
Chicago/Turabian StyleQin, Panke, Bo Ye, Ya Li, Zhongqi Cai, Zhenlun Gao, Haoran Qi, and Yongjie Ding. 2025. "Hybrid BiLSTM-ARIMA Architecture with Whale-Driven Optimization for Financial Time Series Forecasting" Algorithms 18, no. 8: 517. https://doi.org/10.3390/a18080517
APA StyleQin, P., Ye, B., Li, Y., Cai, Z., Gao, Z., Qi, H., & Ding, Y. (2025). Hybrid BiLSTM-ARIMA Architecture with Whale-Driven Optimization for Financial Time Series Forecasting. Algorithms, 18(8), 517. https://doi.org/10.3390/a18080517

