Canopy (software)
| Developer(s) | Anagatam Technologies |
|---|---|
| Initial release | February 10, 2025 |
| Stable release | 3.0.0
/ February 21, 2026 |
| Written in | Python |
| Engine | |
| Operating system | Cross-platform |
| Type | Portfolio optimization, Mathematical finance |
| License | Apache License 2.0 |
| Website | github |
Search Canopy (software) on Amazon.
Canopy is a free and open-source Python library for hierarchical portfolio optimization. Developed by Anagatam Technologies, it implements three allocation algorithms — Hierarchical Risk Parity (HRP), Hierarchical Equal Risk Contribution (HERC), and Nested Cluster Optimization (NCO) — with institutional-grade covariance estimation, configurable risk measures, walk-forward backtesting, and compliance audit trails.
Overview
Canopy provides a unified facade interface for hierarchical portfolio construction, enabling researchers and practitioners to compute optimal portfolio weights in a single function call. Unlike traditional mean-variance approaches that require matrix inversion, hierarchical methods build a hierarchical clustering tree from asset correlations and allocate capital through the tree structure, resulting in more stable and diversified portfolios.[1]
The library targets quantitative analysts, portfolio managers, and academic researchers working on portfolio construction problems.
Algorithms
Hierarchical Risk Parity (HRP)
The HRP algorithm, introduced by Marcos López de Prado in 2016, applies hierarchical clustering to the correlation matrix of asset returns and then uses recursive bisection to allocate weights based on inverse-variance risk parity.[2] Unlike Markowitz mean-variance optimization, HRP does not require matrix inversion, making it more stable for large asset universes.
Hierarchical Equal Risk Contribution (HERC)
HERC, proposed by Thomas Raffinot in 2017, extends HRP with a two-stage allocation: inter-cluster risk parity followed by intra-cluster inverse-variance weighting.[3] It supports four risk measures: variance, CVaR (Conditional Value-at-Risk), CDaR (Conditional Drawdown-at-Risk), and MAD (Mean Absolute Deviation).
Nested Cluster Optimization (NCO)
NCO, also by López de Prado (2019), applies Tikhonov regularization within each cluster before combining inter-cluster allocations.[4] This approach reduces estimation error in the covariance matrix, producing portfolios with lower tail risk.
Features
- Covariance Estimation: Four estimators — Sample, Ledoit-Wolf shrinkage, Marchenko-Pastur denoising, and EWMA
- Detoning: Removes the market-mode eigenvector before clustering for sector-level discrimination
- Portfolio Modes: Long-only, long-short, and market neutral configurations
- Walk-Forward Backtesting: Monthly/quarterly rebalancing with configurable lookback windows
- Audit Trail: JSON-serializable computation logs for MiFID II, SEC Rule 15c3-5, and Basel III/IV regulatory compliance
- Performance Metrics: Sharpe ratio, Sortino ratio, maximum drawdown, CVaR, and information ratio
- Visualization: Dark-theme Plotly charts including dendrograms, correlation heatmaps, and risk contribution charts
Architecture
Canopy uses a facade pattern through its MasterCanopy class, which orchestrates five internal engines:
CovarianceEngine— covariance matrix estimation and eigenvalue analysisClusterEngine— hierarchical clustering with 7 linkage methodsHRP,HERC,NCO— the three optimizer implementationsChartEngine— visualization moduleDataLoader— data ingestion from Yahoo Finance, CSV, and Parquet files
See also
- Portfolio optimization
- Hierarchical risk parity
- Modern portfolio theory
- Risk parity
- Marcos López de Prado
External links
References
- ↑ López de Prado, Marcos (2016). "Building Diversified Portfolios that Outperform Out-of-Sample". The Journal of Portfolio Management. 42 (4): 59–69. doi:10.3905/jpm.2016.42.4.059.
- ↑ López de Prado, M. (2016). Building Diversified Portfolios that Outperform Out-of-Sample. The Journal of Portfolio Management, 42(4), 59–69.
- ↑ Raffinot, T. (2017). Hierarchical Clustering Based Asset Allocation. The Journal of Portfolio Management, 44(2), 89–99.
- ↑ López de Prado, M. (2019). A Robust Estimator of the Efficient Frontier. Available at SSRN.
Category:Free software programmed in Python
Category:Mathematical finance
Category:Portfolio theories
Category:Financial software
Category:Free and open-source software
Category:Software using the Apache license
This article "Canopy (software)" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Canopy (software). Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
