GARCH and the rest of the volatility-model family, plus the tests you need around them.
Python Libraries for Market Analysis and Portfolio Optimization
Indicators, performance statistics, volatility models and optimizers you import — which are still maintained, and what each licence actually allows.
Last updated
This is the layer between the data and the decision: something you pip install and call, not
something you log into. If you need an indicator, a Sharpe ratio, a volatility model, a set of
weights or a trading calendar, it is here. If you need prices, that is
market data APIs; if you need an order simulator with fills and
costs, that is backtesting frameworks.
- Indicators, and the widest function set — TA-Lib.
- A tearsheet from a returns series — quantstats, or ffn if you want the numbers without the report.
- Option and fixed-income pricing — QuantLib.
- Volatility models — arch.
- Weights from a covariance matrix — PyPortfolioOpt to start, skfolio if you already think in scikit-learn, Riskfolio-Lib for the long tail of risk measures.
- Sessions, holidays and early closes — exchange_calendars.
Check the pulse before you check the features
Nothing else on this page matters as much. These are small projects, most of them one person, and the failure mode is not a bad library — it is a good library that stopped.
Check two dates separately: the last release on PyPI and the last commit on the default branch.
They disagree more often than you would expect, and each disagreement means something different.
exchange_calendars is committing through September 2026 with its last
release in March, so half a year of calendar corrections exists only in git.
PyPortfolioOpt has moved to an organisation and is now released by somebody
other than the author whose name is still in the package metadata. GitHub's pushed_at is not a
signal at all — it moves for any branch, including ones nobody merges.
An archived badge is not required for a project to be dead. empyrical has not been touched since
October 2020 and is not archived; the card here is its maintained fork,
empyrical-reloaded. pandas-ta is stranger still
and is the cautionary case: the package installs fine, and the project around it has vanished —
repository 404, documentation domain not answering, author's account emptied.
"BSD" on the README is not the licence you ship under
The licence in the repository covers the repository. What you ship is the dependency tree pip
resolved, and in this category the tree is where the surprises are.
Riskfolio-Lib is plainly BSD-3-Clause, and its install_requires pulls
vectorbt, which is Apache-2.0 with the Commons Clause — a term that forbids selling a
derivative. No module in the installed package imports it. It arrives anyway.
PyPortfolioOpt is MIT, and its optional ECOS and CVXOPT solvers are GPLv3.
TA-Lib is not one licence but two, BSD-3-Clause for the C library and BSD-2-Clause
for the Python wrapper, both of which a redistributed wheel carries. And a compiled extension built
from vendored sources inherits those sources' terms, which is why Riskfolio's binary is not purely
BSD either.
None of this makes any of them unusable. It makes the badge an unreliable answer to the only
question that matters, which is what your legal department will find in site-packages.
The install name is part of the product
More reader-hours are lost here than to any genuine technical difficulty, because the wrong name usually installs something that works — it is just not the thing.
pip install QuantLib is correct and QuantLib-Python is a compatibility shell frozen at version
1.18 from 2020. pip install empyrical gets the abandoned 2020 package; the fork imports under the
same name and must be installed under a different one. ta-lib-bin and TA-Lib-Precompiled are
the wrapper author's own pre-wheel workarounds, stuck in 2022 and no longer needed. And the widely
copied instruction to brew install ta-lib before pip install TA-Lib has been unnecessary since
0.6.5 in August 2025, which is when the wrapper started shipping self-contained wheels across
CPython 3.9–3.14. The README telling you otherwise was never rewritten.
The free solver runs out, and the library tells you where
Every optimizer here sits on cvxpy or its own solver chain, and the open-source solvers cover most of what people actually do: mean-variance, risk parity, hierarchical clustering, the efficient frontier.
Two things push past them. Integer constraints — cardinality, "at most twenty positions", threshold and group limits, discrete share allocation — need a mixed-integer solver, and the free route is SCIP or ECOS_BB rather than the default. And the exotic risk measures do too: Riskfolio-Lib's own documentation marks about ten of its twenty-six, the entropic and relativistic families among them, as strongly preferring MOSEK, because the free solvers either fail or crawl. MOSEK is commercial and free for academics, and unlike most solver vendors it publishes a list price rather than making you ask.
Budget for that before you pick the library with the longest risk-measure list.
What none of them do
They do not backtest, and — the single Yahoo Finance helper each in ffn and quantstats aside — they do not fetch data. That sounds obvious and it is the most common disappointment on arrival: a reader following "portfolio optimization in Python" ends up with a library that takes a covariance matrix and returns weights, and has to go and find prices, build the returns series, and decide what to do with the weights afterwards.
skfolio is the partial exception, and worth stating precisely: its walk-forward and combinatorial purged cross-validation evaluate a rebalancing rule over the weights it produces. That is a real and useful thing. It is not an order simulator, and it models no fills.
What it costs
Nothing, on eleven of the twelve. Portfolio Optimizer is the exception and the odd one in every other way too — a hosted API rather than a package, four euros a month, one person, and your covariance matrix crossing the network to a server in Western Europe. Its anonymous tier is one request per second shared across every anonymous user on earth, which is a design decision, not an outage.
The commercial money in this category is elsewhere: in the solver licence, in the one enterprise support contract sold here around a library that withholds nothing — skfolio's — and in the paid Windows Excel add-in Riskfolio-Lib's author sells separately from the BSD package.
All 12 tools in Analysis Libraries
Compiled from each vendor’s own documentation, pricing page and terms — no card here is marked hands-on yet.
Showing 12 of 12
The maintained fork of Quantopian's empyrical — risk statistics, no plots.
Sessions, minutes and holidays for 69 exchanges, keyed by ISO-10383 code.
Performance stats, drawdowns and portfolio weights from a DataFrame of prices.
The DataFrame indicator library whose repo is gone and whose last release is a year old.
248 portfolio maths endpoints over HTTP — no install, no solver, no account.
Prices in, weights out — efficient frontier, Black-Litterman and HRP.
The open-source derivatives pricing library banks actually use, reachable from Python.
HTML tearsheets and about eighty risk metrics from one pandas series of returns.
Twenty-six convex risk measures, four objectives, one cvxpy-backed optimiser.
Portfolio optimisation as scikit-learn estimators — fit, predict, cross-validate.
The C indicator library everything else wraps — and pip now ships the C part with it.
FAQ
Which Python technical analysis library should I use in 2026?
TA-Lib, and it no longer needs a compiler — the wrapper ships self-contained wheels for CPython 3.9 to 3.14 on Linux, macOS and Windows, and the C library's 0.8.1 release in September 2026 added forty functions. The popular alternative, pandas-ta, is effectively abandoned: its GitHub repository returns 404 and the last release is a beta from September 2025. The maintained continuation is pandas-ta-classic.
Is a BSD or MIT licence on a Python quant library enough to ship a commercial product?
Not by itself. The licence on the repository covers that repository, and pip installs the dependency tree. Riskfolio-Lib is BSD-3-Clause but requires vectorbt, which carries the Commons Clause; PyPortfolioOpt is MIT but its optional ECOS and CVXOPT solvers are GPLv3. Read the licences of what actually lands in the environment, not the badge on the README.
Do these libraries fetch market data?
Barely, and never in a form you would build on. PyPortfolioOpt, Riskfolio-Lib and skfolio ship no fetcher at all, and the indicator libraries start from a price series you supply. The two exceptions are ffn and quantstats, which each carry yfinance as a hard dependency and expose one Yahoo Finance convenience helper — ffn.get and qs.utils.download_returns. Data is a separate shopping trip, and it is what the market data APIs category is for.
Can I backtest with a portfolio optimization library?
Not in the sense of simulating orders, fills and costs. skfolio's walk-forward and combinatorial purged cross-validation are rebalancing studies over the weights it produces, which is a genuinely useful thing and a different thing. If you want an order simulator, that is the backtesting frameworks category.
How do I tell whether a quant library is still maintained?
The last release on PyPI and the last commit on the default branch, checked separately — a repository can be committing weekly while releases stall for six months, which is exactly where exchange_calendars sits. GitHub's pushed_at date is not the answer; it moves for any branch. And an archived badge is not required for a project to be dead: empyrical has been untouched since 2020 and is still not archived.