Enhancing Portfolio Optimization: A Two-Stage Approach with Deep Learning and Portfolio Optimization
Abstract
:1. Introduction
- Leveraging the self-attention mechanism and k-reciprocal NN to optimize the feature matrix and adjacency matrix of a GCN, respectively.
- The development of OHLC (open, high, low, close) charts from the ground up, alongside the construction of a dual-layer CNN model utilizing the LeakyReLU activation function.
- The simultaneous integration of a CNN and GCN to capture both individual stock information and relationships among stocks, culminating in the creation of the AGC-CNN model for stock pre-selection.
- The integration of the AGC-CNN model with the GMV model, establishing a two-stage approach where high-quality stocks are initially identified, followed by portfolio selection optimization.
2. Preliminary Work
2.1. The Global Minimum Variance
2.2. The Convolutional Neural Network
2.3. The Graph Convolutional Network
2.4. Self-Attention Mechanism
2.5. k-Reciprocal Nearest Neighbors
3. Method
3.1. The Stock Pre-Selection Model
3.1.1. Image Creation
3.1.2. Capturing Individual Stock Information Using CNN
3.1.3. Capturing Relationships Among Stocks Using GCN
- Firstly, each stock i is represented as a node and has a feature vector . We use trained weight matrices , , and to map them to query , key , and value .
- Secondly, computing the attention weights by measuring the similarity among queries and keys and scaling is applied to obtain .
- Thirdly, the values of the nodes are weighted and summed using the attention weights, resulting in the ultimate representation : .
- Finally, all nodes are processed to obtain the feature matrix .
3.1.4. Constructing the AGC-CNN Model by Combining a CNN and GCN
3.2. Portfolio Optimization by Using the GMV Model
4. Experimental Process
4.1. The Experiment of Stock Trend Prediction
4.1.1. Data Preparation
4.1.2. Baseline Models
- FFNN: a basic model that learns patterns in stock data to predict stock trends.
- RNN [15]: capable of handling sequential stock data well, capturing time-based patterns to forecast future trends based on past performance.
- LSTM [18]: an advanced version of RNN, designed to remember long-term patterns in stock prices, making it suitable for predicting complex and long-term trends.
- GRU [38]: a simpler and efficient alternative to LSTM, which is capable of real-time trend prediction, useful for quick market response.
- CNN [16]: while commonly used for images, a CNN can process time series stock data to identify short-term trends and price movements.
- Dual-CNN [22]: a dual-layer CNN model, whose input is the same as that of a regular CNN.
- CNN + LSTM [21]: utilizes a CNN to obtain features across various time scales and uses LSTM to capture temporal dependencies in the features.
- AGC-CNN without k-reciprocal NN: the proposed stock trend prediction (AGC-CNN) model does not apply k-reciprocal NN to the adjacency matrix.
- AGC-CNN without self-attention: the proposed stock trend prediction AGC-CNN model does not apply the self-attention mechanism to the feature matrix to extract deep features.
4.1.3. Evaluation Metrics
4.2. The Experiment of Portfolio Optimization
4.2.1. Data Preparation
4.2.2. Baseline Models
4.2.3. Evaluation Metrics
5. Empirical Results
5.1. The Result of Stock Trend Prediction
5.2. The Result of Portfolio Optimization
- (1)
- Panel A: comparison of Cumulative Return
- (2)
- Panel B: comparison of Average Return
- (3)
- Panel C: comparison of Average SR
- (4)
- Panel D: comparison of Average TASR
- (5)
- Panel E: comparison of Average Sortino Ratio
5.3. Discussion: The Effect of COVID-19 and Russia–Ukraine War
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Markowitz, H. Portfolio selection. J. Financ. 1952, 7, 77–91. [Google Scholar] [CrossRef]
- Bodnar, T.; Mazur, S.; Okhrin, Y. Bayesian estimation of the global minimum variance portfolio. Eur. J. Oper. Res. 2017, 256, 292–307. [Google Scholar] [CrossRef]
- Zhou, Z.; Gao, M.; Xiao, H. Big data and portfolio optimization: A novel approach integrating DEA with multiple data sources. Omega 2021, 104, 102479. [Google Scholar] [CrossRef]
- Wang, W.; Li, W.; Zhang, N.; Liu, K. Portfolio formation with pre-selection using deep learning from long-term financial data. Expert Syst. Appl. 2020, 143, 113042. [Google Scholar] [CrossRef]
- Bodnar, O.; Bodnar, T.; Parolya, N. Recent advances in shrinkage-based high-dimensional inference. J. Multivar. Anal. 2022, 188, 104826. [Google Scholar] [CrossRef]
- Holgersson, T.; Karlsson, P.; Stephan, A. A risk perspective of estimating portfolio weights of the global minimum-variance portfolio. AStA Adv. Stat. Anal. 2020, 104, 59–80. [Google Scholar] [CrossRef]
- Yang, F.; Chen, Z.; Li, J.; Tang, L. A novel hybrid stock selection method with stock prediction. Appl. Soft Comput. 2019, 80, 820–831. [Google Scholar] [CrossRef]
- Chen, M.; Chen, B. A hybrid fuzzy time series model based on granular computing for stock price forecasting. Inf. Sci. 2015, 294, 227–240. [Google Scholar] [CrossRef]
- Jiang, M.; Jia, L.; Chen, Z.; Chen, W. The two-stage machine learning ensemble models for stock price prediction by combining mode decomposition, extreme learning machine and improved harmony search algorithm. Ann. Oper. Res. 2020, 309, 553–585. [Google Scholar] [CrossRef]
- Cagliero, L.; Garza, P.; Attanasio, G.; Baralis, E. Training ensembles of faceted classification models for quantitative stock trading. Computing 2020, 102, 1213–1225. [Google Scholar] [CrossRef]
- Tang, H.; Dong, P.; Shi, Y. A new approach of integrating piecewise linear representation and weighted support vector machine for forecasting stock turning points. Appl. Soft. Comput. 2019, 78, 685–696. [Google Scholar] [CrossRef]
- Song, X.; Mitnitski, A.; Cox, J.; Rockwood, K. Comparison of machine learning techniques with classical statistical models in predicting health outcomes. Stud. Health Technol. Inform. 2004, 107, 736–740. [Google Scholar]
- Boulesteix, A.; Schmid, M. Machine learning versus statistical modeling. Biom. J. 2014, 56, 588–593. [Google Scholar] [CrossRef]
- Haan, L.; Mercadier, C.; Zhou, C. Adapting extreme value statistics to financial time series: Dealing with bias and serial dependence. Financ. Stoch. 2016, 20, 321–354. [Google Scholar] [CrossRef]
- Zhao, J.; Zeng, D.; Liang, S.; Kang, H.; Liu, Q. Prediction model for stock price trend based on recurrent neural network. J. Ambient Intell. Humaniz. Comput. 2021, 12, 745–753. [Google Scholar] [CrossRef]
- Sezer, O.; Ozbayoglu, A. Algorithmic financial trading with deep convolutional neural networks: Time series to image conversion approach. Appl. Soft. Comput. 2018, 70, 525–538. [Google Scholar] [CrossRef]
- Ma, W.; Hong, Y.; Song, Y. On Stock Volatility Forecasting under Mixed-Frequency Data Based on Hybrid RR-MIDAS and CNN-LSTM Models. Mathematics 2024, 12, 1538. [Google Scholar] [CrossRef]
- Nelson, D.; Pereira, A.; Oliveira, R. Stock market’s price movement prediction with LSTM neural networks. In Proceedings of the 2017 International Joint Conference on Neural Networks (IJCNN), Anchorage, AK, USA, 14–19 May 2017; pp. 1419–1426. [Google Scholar]
- Mu, S.; Liu, B.; Gu, J.; Lien, C.; Nadia, N. Research on Stock Index Prediction Based on the Spatiotemporal Attention BiLSTM Model. Mathematics 2024, 12, 2812. [Google Scholar] [CrossRef]
- Selvin, S.; Vinayakumar, R.; Gopalakrishnan, E.; Menon, V.; Soman, K. Stock price prediction using LSTM, RNN and CNN-sliding window model. In Proceedings of the 2017 International Conference on Advances in Computing, Communications and Informatics, Udupi, India, 13–16 September 2017; pp. 1643–1647. [Google Scholar]
- Wu, J.; Li, Z.; Herencsar, N.; Vo, B.; Lin, J. A graph-based CNN-LSTM stock price prediction algorithm with leading indicators. Multimed. Syst. 2021, 29, 1–20. [Google Scholar] [CrossRef]
- Jiang, J.; Kelly, B.; Xiu, D. (Re-)Imag(in)ing Price Trends. J. Financ. 2023, 78, 3193–3249. [Google Scholar] [CrossRef]
- Zhou, J.; Cui, G.; Zhang, Z.; Yang, C.; Liu, Z.; Sun, M. Graph neural networks: A review of methods and applications. AI Open 2020, 1, 57–81. [Google Scholar] [CrossRef]
- Zhang, Q.; Chang, J.; Meng, G.; Xu, S.; Xiang, S.; Pan, C. Learning graph structure via graph convolutional networks. Pattern Recognit. 2019, 95, 308–318. [Google Scholar] [CrossRef]
- Kipf, T.; Welling, M. Semi-supervised classification with graph convolutional networks. Neural Process. Lett. 2016, 54, 2645–2656. [Google Scholar]
- Wang, C.; Liang, H.; Wang, B.; Cui, X.; Xu, Y. MG-Conv: A spatiotemporal multi-graph convolutional neural network for stock market index trend prediction. Comput. Electr. Eng. 2022, 103, 108285. [Google Scholar] [CrossRef]
- Li, W.; Bao, R.; Harimoto, K.; Chen, D.; Xu, J.; Su, Q. Modeling the stock relation with graph network for overnight stock movement prediction. In Proceedings of the Twenty-Ninth International Conference on International Joint Conferences on Artificial Intelligence, Yokohama, Japan, 11–17 July 2021; pp. 4541–4547. [Google Scholar]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.; Kaiser, L.; Polosukhin, I. Attention is All you Need. arXiv 2017, arXiv:1706.03762. [Google Scholar]
- Xu, H.; Chai, L.; Luo, Z.; Li, S. Stock movement predictive network via incorporative attention mechanisms based on tweet and historical prices. Neural Comput. 2020, 418, 326–339. [Google Scholar] [CrossRef]
- Lei, Z.; Zhang, C.; Xu, Y.; Li, X. DR-GAT: Dynamic routing graph attention network for stock recommendation. Inf. Sci. 2021, 654, 119833. [Google Scholar] [CrossRef]
- Li, Y.; Lv, S.; Liu, X.; Zhang, Q. Incorporating Transformers and Attention Networks for Stock Movement Prediction. J. Complex. 2022, 1076–2787. [Google Scholar] [CrossRef]
- Wang, Z.; Huang, B.; Tu, S.; Zhang, K.; Xu, L. DeepTrader: A Deep Reinforcement Learning Approach for Risk-Return Balanced Portfolio Management with Market Conditions Embedding. In Proceedings of the Twenty-Ninth International Conference on International Joint Conferences on Artificial Intelligence, Yokohama, Japan, 11–17 July 2021; pp. 643–650. [Google Scholar]
- Jegou, H.; Harzallah, H.; Schmid, C. A contextual dissimilarity measure for accurate and efficient image search. In Proceedings of the 2007 IEEE Conference on Computer Vision and Pattern Recognition, Minneapolis, MN, USA, 17–22 June 2007; pp. 9–16. [Google Scholar]
- Qin, D.; Gammeter, S.; Bossard, L.; Quack, T.; Gool, L. Hello neighbor: Accurate object retrieval with k-reciprocal nearest neighbors. In Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, Colorado Springs, CO, USA, 20–25 June 2011; pp. 777–784. [Google Scholar]
- Bian, Z.; Liao, Y.; O’Neill, M.; Shi, J.; Zhang, X. Large-scale minimum variance portfolio allocation using double regularization. J. Econ. Dyn. Control 2020, 116, 103939. [Google Scholar] [CrossRef]
- Hoang, T. Active portfolio management for the emerging and frontier markets: The use of multivariate time series forecasts. Cogent Econ. Financ. 2022, 10, 2114163. [Google Scholar] [CrossRef]
- Maas, L.A.; Awni, Y.; Andrew, Y. Rectifier nonlinearities improve neural network acoustic models. In Proceedings of the International Conference on International Conference on Machine Learning, Atlanta, GA, USA, 16–21 June 2013; Volume 30. [Google Scholar]
- Yang, L.; Zhang, Z.; Xiong, S.; Wei, L.; Ng, J.; Xu, L.; Dong, R. Explainable text-driven neural network for stock prediction. In Proceedings of the 2018 5th IEEE International Conference on Cloud Computing and Intelligence Systems, Nanjing, China, 23–25 November 2018; pp. 441–445. [Google Scholar]
- Fischer, T.; Krauss, C. Deep learning with long short-term memory networks for financial market predictions. Eur. J. Oper. Res. 2018, 270, 654–669. [Google Scholar] [CrossRef]
- Ledoit, O.; Wolf, M. Improved estimation of the covariance matrix of stock returns with an application to portfolio selection. J. Empir. Financ. 2003, 10, 603–621. [Google Scholar] [CrossRef]
- Ledoit, O.; Wolf, M. A well-conditioned estimator for large-dimensional covariance matrices. J. Multivar. Anal. 2004, 88, 365–411. [Google Scholar] [CrossRef]
- Kourtis, A.; Dotsis, G.; Markellos, R. Parameter uncertainty in portfolio selection: Shrinkage the inverse covariance matrix. J. Bank. Financ. 2012, 36, 2522–2531. [Google Scholar] [CrossRef]
- Christoffersen, P.; Errunza, V.; Jacobs, K.; Jin, X. Correlation Dynamics And International Diversification Benefits. Int. J. Forecast. 2014, 30, 807–824. [Google Scholar] [CrossRef]
- Broadstock, D.; Chatziantoniou, I.; Gabauer, D. Minimum Connectedness Portfolios and the Market for Green Bonds: Advocating Socially Responsible Investment (SRI) Activity. In Applications in Energy Finance; Springer: Berlin/Heidelberg, Germany, 2002; pp. 217–253. [Google Scholar] [CrossRef]
- Cheng, T.; Chen, K. A general framework for portfolio construction based on generative models of asset returns. J. Finance Data Sci. 2023, 9, 100113. [Google Scholar] [CrossRef]
- Rapoport, A. Minimization of risk and maximization of expected utility in multistage betting games. Acta Psychol. 1970, 34, 375–386. [Google Scholar] [CrossRef]
- Palma, G.; Skoczeń, M.; Maguire, P. Combining supervised and unsupervised learning methods to predict financial market movements. arXiv 2024, arXiv:2409.03762. [Google Scholar]
- DeMiguel, V.; Garlappi, L.; Nogales, F.; Uppal, R. A generalized approach to portfolio optimization: Improving performance by constraining portfolio norms. Manage. Sci. 2009, 55, 798–812. [Google Scholar] [CrossRef]
- Lan, W.; Wang, H.; Tsai, C. A Bayesian information criterion for portfolio selection. Comput. Stat. Data Anal. 2012, 56, 88–99. [Google Scholar] [CrossRef]
- Ledoit, O.; Wolf, M. Robust performance hypothesis testing with the Sharpe ratio. J. Empir. Financ. 2008, 15, 850–859. [Google Scholar] [CrossRef]
- Ledoit, O.; Wolf, M. Nonlinear shrinkage of the covariance matrix for portfolio selection: Markowitz meets Goldilocks. Rev. Financ. Stud. 2017, 30, 4349–4388. [Google Scholar] [CrossRef]
- Evans, J.; Archer, S. Diversification and the reduction of dispersion: An empirical analysis. J. Financ. 1968, 23, 761–767. [Google Scholar] [CrossRef]
- Alexeev, V.; Dungey, M. Equity portfolio diversification with high-frequency data. Quant. Financ. 2015, 15, 1205–1215. [Google Scholar] [CrossRef]
Abbreviation | Description |
---|---|
Panel A: The traditional portfolio optimization model. | |
Equal Weight | |
GMV | Global Minimum Variance model [1] |
MV | Minimum Variance [1] |
LW(id), LW(lf) | Minimum Variance portfolio from Ledoit and Wolf [40,41] |
ICVARI(F), ICVARIF | Minimum Variance portfolio from Kourtis et al. [42] |
MCP | Minimum Correlation Portfolio [43] |
MCoP | Minimum Connectedness Portfolio [44] |
MaxSR | Maximizing Sharpe Ratio [45] |
MinRisk | Minimizing risk [46] |
MaxEU | Maximizing Expected Utility [46] |
GMM + RF | Gaussian Mixture Models with Random Forests [47] |
Panel B: Two-stage approach with stock selection followed by optimization. | |
AGC-CNN + GMV | AGC-CNN to select stocks, GMV for portfolio strategy |
AGC-CNN + MaxSR | AGC-CNN to select stocks, MaxSR for portfolio strategy |
AGC-CNN + | AGC-CNN to select stocks, Equal Weight for portfolio strategy |
Dual-CNN + GMV | Dual-CNN to select stocks, GMV for portfolio strategy |
Dual-CNN + | Dual-CNN to select stocks, Equal Weight for portfolio strategy |
CNN-LSTM + GMV | CNN-LSTM to select stocks, GMV for portfolio strategy |
CNN-LSTM + | CNN-LSTM to select stocks, Equal Weight for portfolio strategy |
LSTM + GMV | LSTM to select stocks, GMV for portfolio strategy |
LSTM + | LSTM to select stocks, Equal Weight for portfolio strategy |
Abbreviation | Description |
---|---|
Cumulative Return | |
Average Return | |
Variance | |
Sharp Ratio | |
Sortino Ratio | |
Turnover |
Method/Time Periods | 2012–2014 | 2015–2017 | 2018–2020 | 2021–2023 |
---|---|---|---|---|
AGC-CNN | 0.5998 | 0.5899 | 0.5697 | 0.5706 |
Dual-CNN | 0.5771 | 0.5770 | 0.5522 | 0.5573 |
CNN-LSTM | 0.5633 | 0.5611 | 0.5590 | 0.5587 |
CNN | 0.5370 | 0.5470 | 0.5499 | 0.5408 |
FFNN | 0.5266 | 0.5121 | 0.4995 | 0.5049 |
RNN | 0.5424 | 0.5375 | 0.5622 | 0.5229 |
LSTM | 0.5345 | 0.5612 | 0.5558 | 0.5555 |
GRU | 0.5434 | 0.5469 | 0.5608 | 0.5568 |
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. |
© 2024 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
Huang, S.; Cao, L.; Sun, R.; Ma, T.; Liu, S. Enhancing Portfolio Optimization: A Two-Stage Approach with Deep Learning and Portfolio Optimization. Mathematics 2024, 12, 3376. https://doi.org/10.3390/math12213376
Huang S, Cao L, Sun R, Ma T, Liu S. Enhancing Portfolio Optimization: A Two-Stage Approach with Deep Learning and Portfolio Optimization. Mathematics. 2024; 12(21):3376. https://doi.org/10.3390/math12213376
Chicago/Turabian StyleHuang, Shiguo, Linyu Cao, Ruili Sun, Tiefeng Ma, and Shuangzhe Liu. 2024. "Enhancing Portfolio Optimization: A Two-Stage Approach with Deep Learning and Portfolio Optimization" Mathematics 12, no. 21: 3376. https://doi.org/10.3390/math12213376
APA StyleHuang, S., Cao, L., Sun, R., Ma, T., & Liu, S. (2024). Enhancing Portfolio Optimization: A Two-Stage Approach with Deep Learning and Portfolio Optimization. Mathematics, 12(21), 3376. https://doi.org/10.3390/math12213376