QuantStats is a Python library for portfolio analytics that helps quants and portfolio managers evaluate strategy performance through in-depth metrics and risk analysis.
The tool addresses the need to understand portfolio behavior beyond simple returns by providing three core modules: a stats module for calculating performance metrics like Sharpe ratio, win rate, and volatility; a plots module for visualizing performance, drawdowns, and rolling statistics; and a reports module for generating tear sheets and batch analyses. It includes Monte Carlo simulation capabilities for probabilistic risk analysis. The library operates on return series data rather than discrete trade entries, making it well-suited for systematic and algorithmic strategies with regular rebalancing where period-based metrics like consecutive wins and profit factors are meaningful.
Developers should understand that QuantStats analyzes returns at the period level (daily, weekly, or monthly), not at individual trade boundaries. This approach works well for algorithmic trading strategies and systematic rebalancing but may not align with how discretionary traders track multi-day trades. The library can generate reports in multiple formats, including interactive HTML tear sheets, and provides both basic and full metric variants depending on analysis depth needed.
The project shows consistent maintenance with regular updates documented in its changelog. Development activity demonstrates ongoing refinement of existing functionality and documentation improvements to clarify how period-based metrics work and their appropriate use cases.