4.5k stars · BSD-3-Clause · 7.3.0 on PyPI (2026-05-31) · Track this in Scout
Portfolio optimisation with a large library of risk measures — how capital should be split across strategies.
▶Repo detailsthe review · specs · pros & cons · install
What it is
Riskfolio-Lib is a Python library for portfolio optimisation. It takes the returns of several assets or strategies and produces the mix that best balances return against a risk measure you choose, of which it supports a large number.
What it is good for. Anyone with several things to allocate between: strategies, instruments, or time windows. Edition 13 recommended ffn, which answers "which of these candidates is best". This answers the next question, which is "how much of each". Anyone running a single strategy on one pair today can leave this for later. It becomes useful the moment there is a second strategy, or the same strategy on a second pair.
- A very large set of risk measures, not only the textbook one.
- It draws the results, so the output is a chart rather than a wall of numbers.
- It works directly with pandas, the standard Python table library, so your existing data fits.
- This is finance mathematics. It gives confident answers to questions you may be asking wrongly.
- It optimises on past returns. Past returns are not a promise, and on a single strategy it will tell you to put everything in it.
- Installing it pulls in a solver library, so the first install is larger and slower than most.
cd ~/myapp source venv/bin/activate pip install Riskfolio-Lib


