PortfoliosLab logoPortfoliosLab logo

HRP optimization

MC
Mike CooperSeptember 08, 25 | Posted in General
I set up a portfolio and asked it to be optimized by the hrp optimization. The response I get is that it can't be optimized. Does that make sense?
3 comments
4 replies

Sort by

DS
Dmitry ShevchenkoSeptember 09, 25
Sometimes the optimization equation cannot be solved due to infeasible constraints or issues with building the covariance matrix. What input parameters are you using? We can take a closer look and confirm whether that’s expected or not.

MC

I entered about 10 securities totalling 100%. It's a static portfolio.

Set optz as std deviation. Risk free rate 3%. No optz date, or 1 6 months ago

Hmm, the settings look fine. Could you share your portfolio holdings with us at support@portfolioslab.com? There might be an issue with the prices or their correlations that doesn’t work with this optimization method.

MC
Mike CooperSeptember 09, 25

Thanks for sharing your portfolio. The issue comes from including USD Cash in the HRP optimization. Since cash has zero return and zero variance, the algorithm hits a divide-by-zero when trying to allocate risk weights (HRP uses inverse variance for allocation). That’s why the optimization fails.

I'd recommend excluding cash from the optimization and treat it as a separate allocation decision (e.g., decide your cash level first, then run HRP on the risky assets).


MC
Mike CooperSeptember 10, 25
Thx. Error message would be helpful too!

Agree, added a task to improve error messaging there


Category
General

Views
186