A Machine Learning-Based Hierarchical Risk Parity Approach: A Case Study of Portfolio Consisting of Stocks of the Top 30 Companies on the Tehran Stock Exchange

Document Type : Research Paper


1 Ph.D., Department of Financial Engineering, Faculty of Economic, Management and Accounting, Yazd University, Yazd, Iran.

2 Associate Prof., Department of Financial Management, Faculty of Economic, Management and Accounting, Yazd University, Yazd, Iran.


Objective: The problem of securities optimization is a significant financial problem, and the issue of choosing the optimal stock portfolio has long occupied the minds of investment professionals. Under uncertain conditions, it is essential to determine asset allocation. The creation of a portfolio of investments is one of the most common financial challenges faced by investors. For them, building a portfolio of investments that yields the highest level of profit is imperative. Various methods have been introduced to construct a portfolio, the most famous of which is the Markowitz approach. There are numerous shortcomings with mean-variance theory due to its difficulty in estimating expected returns and covariances for different asset classes. The problem with the Markowitz variance-mean method, estimation errors, and inconsistencies led to the development of several other academics' attempts to find possible portfolio solutions that would lead to optimal asset allocation. To overcome this problem, Marcos Lopez de Prado was the first researcher to propose a hierarchical model for portfolio construction in his famous paper “Building Diversified Portfolios that outperform out-of-sample”, in 2016.
Methods:The present study is applied in terms of purpose, quantitative in terms of the implementation process, and retrospective and post-event in terms of time. This research focuses on the application of machine learning in selecting the optimal portfolio and its purpose is to find a stock portfolio optimization method that has superior performance in prototype simulation for the Tehran Stock Exchange. In this study, we use the Hierarchical Risk Parity (HRP) machine learning technique and compare the results with the minimum variance approach. The concept of HRP is based on graph theory and machine learning techniques and can be divided into three main stages including tree clustering, quasi-diagonalization, and recursive bisection. To conduct this research, the adjusted closing prices of 30 listed companies for 760 trading days from 2018 to 2020 were used. Missing values were filled by propagating the last valid observation forward
Results: To evaluate portfolio performance, the Sharpe ratio was measured for both in-sample and out-of-sample periods. The results of in-sample and out-of-sample analyses showed that the Hierarchical Risk Parity approach performs better than the minimum variance approach.
Conclusion: In this study, the researchers employed a novel asset allocation method – Hierarchical Risk Parity (HRP) which has the most desirable diversification properties. HRP provides a meaningful alternative to traditional asset allocation approaches and an important risk management tool for investors. Therefore, portfolio managers should have an active approach in evaluating each method according to the conditions and situations in which they are.


Baitinger, E., & Papenbrock, J. (2016). Interconnectedness risk and active portfolio management. Journal of Investment Strategies, Forthcoming. Available at SSRN: https://ssrn.com/abstract=2909839
Bechis, L., Cerri, F., & Vulpiani, M. (n.d.). (2020). Machine Learning Portfolio Optimization: Hierarchical Risk Parity and Modern Portfolio Theory.
Brinson, G. P., Hood, L. R., & Beebower, G. L. (1986). Determinants of portfolio performance. Financial Analysts Journal, 42(4), 39–44.
Burggraf, T. (2020). Beyond Risk Parity–A Machine Learning-based Hierarchical Risk Parity Approach on Cryptocurrencies. Finance Research Letters, 101523.
Cochrane, J. H. (1999). Portfolio advice for a multifactor world. National Bureau of Economic Research.
De Prado, M. L. (2016). Building diversified portfolios that outperform out of sample. The Journal of Portfolio Management, 42(4), 59–69.
Dose, C., & Cincotti, S. (2005). Clustering of financial time series with application to index and enhanced index tracking portfolio. Physica A: Statistical Mechanics and Its Applications, 355(1), 145–151.
Hüttner, A., Mai, J.-F., & Mineo, S. (2018). Portfolio selection based on graphs: Does it align with Markowitz-optimal portfolios? Dependence Modeling, 6(1), 63–87.
Jain, P., & Jain, S. (2019). Can machine learning-based portfolios outperform traditional risk-based portfolios? the need to account for covariance misspecification. Risks, 7(3), 74.
León, D., Aragón, A., Sandoval, J., Hernández, G. J., Arévalo, A., & Niño, J. (2017). Clustering algorithms for Risk-Adjusted Portfolio Construction. ICCS, 1334–1343.
Lohre, H., Rother, C., & Schäfer, K. A. (2020). Hierarchical risk parity: Accounting for tail dependencies in multi-asset multi-factor allocations. Machine Learning and Asset Management, Forthcoming.
Simon, H. A. (1991). The Architecture of Complexity. In Facets of Systems Science, 457–76. Springer.
Onnela, J.-P., Chakraborti, A., Kaski, K., Kertesz, J., & Kanto, A. (2003). Dynamics of market correlations: Taxonomy and portfolio analysis. Physical Review E, 68(5), 56110.
Peralta, G., & Zareei, A. (2016). A network approach to portfolio selection. Journal of Empirical Finance, 38, 157–180.
Raffinot, T. (2017). Hierarchical clustering-based asset allocation. The Journal of Portfolio Management, 44(2), 89–99.
Raffinot, T. (2018). The hierarchical equal risk contribution portfolio. Available at SSRN 3237540.
Ren, F., Lu, Y.N., Li, S.P., Jiang, X.F., Zhong, L.X., & Qiu, T. (2017). Dynamic portfolio strategy using clustering approach. PloS One, 12(1), e0169299.
Karimi, A. (2021). Stock portfolio optimization using multi-objective genetic algorithm (NSGA II) and maximum Sharp ratio. FEJ, 12(46), 389–410. (in Persian)
Nabizade, A., Gharehbaghi, H., & Behzadi, A. (2017). Index Tracking Optimization under down Side Beta and Evolutionary Based Algorithms. Financial Research Journal, 19(2), 319–340. https://doi.org/10.22059/jfr.2017.226501.1006374. (in Persian)
Noorahmadi, M., Sadeghi, H., (2019), a review of missing value management methods in time series. 6th Mathematics and Humanities Seminar (Financial Mathematics). https://femath6.atu.ac.ir/paper?manu=107697 (in Persian)
Taghizadeh Yazdi, M. R., Fallahpour, S., & Ahmadi Moghaddam, M. (2017). Portfolio selection by means of Meta-goal programming and extended lexicograph goal programming approaches. Financial Research Journal, 18(4), 591–612. https://doi.org/10.22059/jfr.2017.62580. (in Persian)