---
title: "Hierarchical Clustering-Based Risk Parity Portfolio"
method: POST
path: "/portfolios/optimization/hierarchical-risk-parity/clustering-based"
tags: ["Portfolio Optimization"]
---

# Hierarchical Clustering-Based Risk Parity Portfolio

`POST /portfolios/optimization/hierarchical-risk-parity/clustering-based`

Compute the asset weights of the hierarchical clustering-based risk parity portfolio, optionally subject to:  
* Minimum and maximum weights constraints
* Minimum and maximum portfolio exposure constraints

References
 * [Machine Learning for Asset Management: New Developments and Financial Applications, Emmanuel Jurczenko, Chapter 9, Harald Lohre,Carsten Rother,Kilian Axel Schäfer, Hierarchical Risk Parity: Accounting for Tail Dependencies in Multi-asset Multi-factor Allocations](https://onlinelibrary.wiley.com/doi/10.1002/9781119751182.ch9)
 * [Thomas Raffinot, Hierarchical Clustering-Based Asset Allocation, The Journal of Portfolio Management Multi-Asset Special Issue 2018, 44 (2) 89-99](https://jpm.pm-research.com/content/44/2/89.abstract)
 * [Raffinot, Thomas, The Hierarchical Equal Risk Contribution Portfolio](https://ssrn.com/abstract=3237540)
 * [Johann Pfitzinger & Nico Katzke, 2019. A constrained hierarchical risk parity algorithm with cluster-based capital allocation. Working Papers 14/2019, Stellenbosch University, Department of Economics](https://ideas.repec.org/p/sza/wpaper/wpapers328.html)

## Request body

- object
  - `assets` integer, required — The number of assets
  - `assetsCovarianceMatrix` array[], required — assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
    - number[]
  - `clusteringMethod` 'singleLinkage' | 'averageLinkage' | 'completeLinkage' | 'wardLinkage' — The hierarchical clustering method to use
  - `clusteringOrdering` 'r-hclust' | 'optimal' — The order to impose on the hierarchical clustering tree leaves
  - `clusters` integer — The number of clusters to use in the hierarchical clustering tree; if not provided, the number of clusters to use is computed using the gap statistic method, as described in the first reference
  - `acrossClusterAllocationMethod` 'equalWeighting' | 'inverseVolatility' | 'inverseVariance' — The allocation method to use across clusters
  - `withinClusterAllocationMethod` 'equalWeighting' | 'inverseVolatility' | 'inverseVariance' — The allocation method to use within clusters
  - `constraints` object
    - `minimumAssetsWeights` number[] — minimumAssetsWeights[i] is the minimum weight of the asset i in the portfolio, in percentage
    - `maximumAssetsWeights` number[] — maximumAssetsWeights[i] is the maximum weight of the asset i in the portfolio, in percentage
    - `minimumPortfolioExposure` number — The minimum portfolio exposure; must be lower than or equal to maximumPortfolioExposure
    - `maximumPortfolioExposure` number — The maximum portfolio exposure; must be higher than or equal to minimumPortfolioExposure

## Response `200`

OK

- object
  - `assetsWeights` number[], required — assetsWeights[i] is the weight of the asset i in the portfolio, in percentage

---

[API](https://skmtc.net/portfoliooptimizer/apis/portfolio-optimizer.md) · [All operations](https://skmtc.net/portfoliooptimizer/apis/portfolio-optimizer/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/portfoliooptimizer/portfolio-optimizer/revisions/dee9caba1913/schema)
