What it does
QuantStats is a Python library for portfolio statistics, benchmark comparisons and HTML performance reports. It analyzes regular return series, such as daily or monthly observations. Its separate statistics, plotting and reporting modules can be used individually, and the code is available under Apache 2.0.
QuantStats separates statistics, plots and reports. Supply a return series, inspect drawdowns or rolling measures, then use qs.reports.html to create a report with a chosen benchmark. The benchmark can be another pandas series or a supported ticker. Basic and full report options provide different levels of detail.
The key interpretation limit is the unit being counted. A win rate describes positive return periods, not winning trades. One trade held over several days can include both positive and negative daily observations. QuantStats is therefore suited to comparing return histories; it does not replace a trade-by-trade execution log.
Its Monte Carlo tools explore alternative paths by reshuffling historical returns. Choose the number of simulations, a reproducible random seed and optional loss or return thresholds. The result exposes distributions, confidence bands, plots and the simulated data as a table. These outcomes depend on the supplied history and simulation method, rather than establishing future probabilities with certainty.
The package is free under its Apache licence and runs without a QuantStats login. Install it with pip install quantstats; the current requirements start at Python 3.10. Data downloaded through another service still follows that service’s access and licensing terms.
Strengths
- Exports HTML reports combining metrics and benchmark comparisons
- Offers statistics and plots independently of the full report
- Simulation results expose both summary distributions and underlying path data
Watch out for
- Win and loss metrics count return periods rather than individual trades
- Simulated paths are derived from the supplied historical return series
Best for
- Analysts producing portfolio performance reports from return data
- Python users examining drawdowns and alternative historical return paths
Sources
- QuantStats report workflow, period metrics and installation (Oct 27, 2026)
- QuantStats Monte Carlo inputs, outputs and path data (Oct 27, 2026)
- QuantStats Apache License 2.0 (Oct 27, 2026)
