Riskfolio-Lib
by Dany Cajas · Library · also known as riskfolio
Python library for quantitative portfolio optimization with many risk measures, robust estimators and hierarchical clustering models
Overview
Riskfolio-Lib is an open-source Python library by Dany Cajas for portfolio construction and risk analysis. It formulates allocation problems with cvxpy and supports a long list of risk measures (variance, MAD, CVaR, EVaR, drawdown-based measures and more), mean-risk, risk-parity, worst-case and robust optimization, Black-Litterman and factor models, and hierarchical approaches such as HRP and HERC. Plotting helpers draw efficient frontiers, risk contributions and drawdown charts, and reports can be exported to Excel. It is aimed at practitioners and researchers who need more risk measures than a basic mean-variance toolkit offers. The breadth comes with a dense API, dependence on commercial or open solvers for some problems, and no backtesting or data layer.
Capabilities
- Mean-risk optimization across more than a dozen risk measures
- Risk parity and risk budgeting
- Hierarchical risk parity and HERC clustering portfolios
- Black-Litterman and factor-model estimators
- Worst-case and robust optimization
- Frontier, risk-contribution and drawdown plots
Typical workflows
- Compare CVaR-optimal and variance-optimal frontiers on the same universe
- Build a risk-parity allocation and export the report to Excel
Strengths
- Wide choice of risk measures and models
- BSD-3-Clause license
Limitations
- Dense API with many options to configure
- Some formulations need capable solvers
- No backtesting or data retrieval
Prerequisites
- Python with cvxpy, pandas and a supported solver
Who it is for
- Portfolio managers and risk analysts
- Finance researchers
Alternatives & comparison
PyPortfolioOpt offers a smaller, more approachable subset of the same ideas; Riskfolio-Lib adds many risk measures, robust models and clustering methods. QuantLib is a pricing library and does not do allocation.
- Ghostfolio
Open-source wealth-tracking web app for stocks, ETFs, crypto and other assets, self-hostable with Docker or used as a hosted service
Open sourceOpen source - PyPortfolioOpt
Python library for portfolio optimization: efficient frontier, Black-Litterman, hierarchical risk parity and discrete allocation
Open sourceOpen source - QuantLib
Open-source C++ library for quantitative finance covering instruments, term structures, pricing engines and calendars, with Python and other bindings
Open sourceOpen source
Sources & verification
Primary sources consulted for this record. Claims are tied to the fields each source supports; the automated link checker re-verifies every URL on a schedule.
- LicenseLICENSE.txt (BSD 3-Clause)checked Nov 1, 2026
https://github.com/dcajasn/Riskfolio-Lib/blob/master/LICENSE.txt
Supports: license_spdx
- Official siteRiskfolio-Lib documentationchecked Nov 1, 2026
https://riskfolio-lib.readthedocs.io/en/latest
Supports: name, summary, capabilities
- Repositorychecked Nov 1, 2026
- Confidence
- High
- Reviewed
- Nov 1, 2026
- Links
- Verified · Nov 2, 2026
Spotted an error?
More in Portfolio & wealth management
Ghostfolio
Ghostfolio · Portfolio & wealth management
Open-source wealth-tracking web app for stocks, ETFs, crypto and other assets, self-hostable with Docker or used as a hosted service