quantstats
Portfolio analytics for quants
Decision gist · record as of 2026-08-14
Yes. QuantStats is actively maintained, has no known vulnerabilities, uses permissive licensing, and installs with low friction. It is well-suited if you need to compute standard portfolio metrics and generate tearsheets. Be aware that it operates on return periods, not discrete trades—if you trade multi-day positions, period-based metrics like win rate will differ from trade-level statistics. Verify that its metric definitions align with your risk model before relying on it for critical decisions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >= 3.10.
- yfinance dependency needs internet access to download market data.
- Low friction installation with a pure-Python wheel.
License · maintenance · safety
Apache-2.0 (permissive) — Distributed under Apache-2.0 (permissive). You can use, modify, and distribute QuantStats freely in commercial and private projects with minimal restrictions.
last release 2026-01-13 (213 days) · last repo commit 2026-07-20 · 7,547 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 315,897 downloads/mo, #7,682 on PyPI
Alternatives
Verify before relying
pip install quantstats
import quantstats as qs
stock = qs.utils.download_returns('META')
sharpe = qs.stats.sharpe(stock)
qs.plots.snapshot(stock, title='Performance', show=True)
qs.reports.html(stock, 'SPY')- Whether Monte Carlo simulations (bust_probability, goal_probability) are suitable for your risk model assumptions.
- How period-based metrics (win rate, consecutive wins) map to your specific trading workflow if you use multi-day trades.
- Performance characteristics with very large return series or high-frequency data.
What it is and what it does
QuantStats is a Python library for analyzing and visualizing portfolio returns. It calculates standard performance metrics like Sharpe ratio, Sortino ratio, maximum drawdown, volatility, and win rate from a time series of returns, then visualizes them via matplotlib and seaborn plots or generates interactive HTML tearsheets for comparison against benchmarks. The library operates on return periods (daily, weekly, monthly) rather than discrete trades, making it well-suited for systematic strategies with regular rebalancing.
The package wraps eight core dependencies—numpy, pandas, scipy, matplotlib, seaborn, tabulate, yfinance, and python-dateutil—to provide three main modules: `stats` for metric calculation, `plots` for visualization, and `reports` for batch analysis and tearsheet generation. It includes Monte Carlo simulation for probabilistic risk analysis and can extend pandas DataFrames with convenience methods like `.sharpe()` and `.plot_snapshot()`.
Use it for
- Calculate and compare Sharpe ratio, Sortino ratio, and other risk-adjusted returns for a strategy against a benchmark.
- Generate an HTML tearsheet showing monthly returns, drawdowns, rolling volatility, and performance metrics for stakeholder reporting.
- Run Monte Carlo simulations to estimate bust probability and goal probability for a portfolio under different market scenarios.
- Visualize daily returns, drawdown periods, and rolling statistics to identify performance patterns and risk periods.
- Analyze win rate, consecutive wins/losses, and profit factor for systematic trading strategies on a period-by-period basis.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
QuantStats is actively maintained, has no known vulnerabilities, uses permissive licensing, and installs with low friction. It is well-suited if you need to compute standard portfolio metrics and generate tearsheets. Be aware that it operates on return periods, not discrete trades—if you trade multi-day positions, period-based metrics like win rate will differ from trade-level statistics. Verify that its metric definitions align with your risk model before relying on it for critical decisions.
Install
quantstats on PyPI
Before you install
Low friction installation with a pure-Python wheel. Actively maintained with recent commits and a large community (7547 stars). Requires Python >= 3.10 and eight runtime dependencies including numpy, pandas, scipy, matplotlib, and yfinance—all stable, widely-used libraries.
Requires Python >= 3.10. yfinance dependency needs internet access to download market data.
License in practice
Distributed under Apache-2.0 (permissive). You can use, modify, and distribute QuantStats freely in commercial and private projects with minimal restrictions.
Quickstart
pip install quantstats
import quantstats as qs
stock = qs.utils.download_returns('META')
sharpe = qs.stats.sharpe(stock)
qs.plots.snapshot(stock, title='Performance', show=True)
qs.reports.html(stock, 'SPY')
Verify before relying
- Whether Monte Carlo simulations (bust_probability, goal_probability) are suitable for your risk model assumptions.
- How period-based metrics (win rate, consecutive wins) map to your specific trading workflow if you use multi-day trades.
- Performance characteristics with very large return series or high-frequency data.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 8 packagesmatplotlibnumpypandaspython-dateutilscipyseaborntabulateyfinance |
| Maintenance | Actively maintained 213 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 315,897 / month, #7,682 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Financial and Insurance IndustryIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Office/Business :: FinancialTopic :: Office/Business :: Financial :: InvestmentTopic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Information AnalysisTopic :: Scientific/Engineering :: MathematicsTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules |
Evidence: quantstats-0.0.81-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “portfolio performance analytics”
- quantstatsQuantStats computes portfolio performance metrics (Sharpe ratio,…
- vectorbtVectorized backtesting engine that packs thousands of trading…
- QuantLibQuantLib provides Python bindings to a C++ library for quantitative…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also empyrical-reloaded · gs-quant · backtesting · skfolio · pyportfolioopt · QuantLib · riskfolio-lib · pvanalytics · vnstock-ezchart · vollib