TradeBot Check
Trading involves a risk of losing money. Nothing on this site is financial advice and past results do not guarantee future results. Risk disclosure
Backtesting

Riskfolio-Lib

Python library for portfolio optimization built on CVXPY and Pandas, with mean-risk, risk parity, hierarchical clustering and Black-Litterman models plus reports and charts.

dcajasn/Riskfolio-Lib★ 4,642 stars last commit 2026-11-04
Our take

Compare how different portfolio-construction methods and risk measures behave on your own returns data, all in Python.

Who it is for

Students, analysts and Python users who want to study diversification and risk budgeting on their own data, for research and education.

Strengths

  • Mean-risk and Kelly (log mean-risk) optimization with 26 convex risk measures, plus risk parity with 22 risk measures.
  • Hierarchical clustering portfolios (HRP, HERC) and Nested Clustered Optimization.
  • Black-Litterman, entropy pooling and risk-factor models; constraints such as turnover and cardinality.
  • Efficient-frontier plots and reports in Jupyter and Excel; installs with pip install riskfolio-lib.

Good to know

  • Needs Python 3.10 or higher and a long list of scientific dependencies.
  • Requires some knowledge of portfolio theory; results depend on the data and assumptions you feed in.
  • Some large models work best with commercial solvers (MOSEK, GUROBI), which are separate products.
  • Optimization is not a forecast: any example is illustrative and never a promise of returns.

Custom bots are coming soon
We are preparing a service to build bots on tools like this one. Follow our Telegram channel to know when it opens.

Notify me

Real-life uses

Diversification check for a small watchlist

Feed the daily returns of a handful of assets into a script that compares equal-weight, risk-parity and hierarchical portfolios, so you see how risk is spread before choosing any limits. Illustrative only, never a promise of returns.

🧮 Compared 3 methods on 5 assets: largest risk share 38% equal-weight vs 24% risk-parity (example figures).

Compare it with others

Quick answers

How much does Riskfolio-Lib cost?

Free and open source (BSD-3-Clause). Optional commercial solvers such as MOSEK or GUROBI are separate products; check their official websites for costs. Prices change, so check the official website before you decide.

Is Riskfolio-Lib open source?

Yes. License: BSD-3-Clause.

Who is Riskfolio-Lib for?

Students, analysts and Python users who want to study diversification and risk budgeting on their own data, for research and education.

What is Riskfolio-Lib written in?

Riskfolio-Lib is written in Python.

What should I know before using Riskfolio-Lib?

Needs Python 3.10 or higher and a long list of scientific dependencies. Requires some knowledge of portfolio theory; results depend on the data and assumptions you feed in. Some large models work best with commercial solvers (MOSEK, GUROBI), which are separate products. Optimization is not a forecast: any example is illustrative and never a promise of returns.

Want a bot like this when custom bots open? Get notified · All comparisons · Guides

Sources

Every fact on this page comes from these sources, checked on 2026-11-13. If something has changed, the source wins.

  1. https://raw.githubusercontent.com/dcajasn/Riskfolio-Lib/master/README.md: features, risk measure counts, constraints, reports, pip install, Python 3.10+, optional MOSEK/GUROBI, docs link
  2. https://api.github.com/repos/dcajasn/Riskfolio-Lib: BSD-3-Clause, about 4,600 stars, last push 2026-11-04, not archived

Alternatives in Backtesting