Portfolio analytics for quants, written in Python
Alternatives To Quantstats
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Quantstats2,83211a month ago59July 05, 2022129apache-2.0Python
Portfolio analytics for quants, written in Python
Stock Analysis154
2 months agomitPython
Simple to use interfaces for basic technical analysis of stocks.
3 years agoPython
A flask web app that analyzes your stock portfolio performance, optimizes your asset allocation, and provides performance enhancement alerts.
9 months agoJupyter Notebook
Data Science Portfolio for Andrew DeCotiis-Mauro. Covers topics such as CEO compensation, congressional partisanship, web scraping, grade analysis and education.
Intro Dataviz Summer188
3 years ago
5 years agoHTML
A data visualization platform that helps users assess their portfolios
2 years ago4mitJupyter Notebook
Personal portfolio that covers interesting AI, ML, DL and DS topics
8 years agoR
An energy consumption and demand visualization sandbox for a portfolio of (anonymized) buildings. A R/Shiny application.
Dataviz Project3
7 years ago13gpl-3.0HTML
Documentation and portfolio for the Data Visualization project.
2 years ago
Srajan Kumar Shukla portfolio
Alternatives To Quantstats
Select To Compare

Alternative Project Comparisons
Python version PyPi version PyPi status Travis-CI build status PyPi downloads CodeFactor Star this repo Follow me on twitter

QuantStats: Portfolio analytics for quants

QuantStats Python library that performs portfolio profiling, allowing quants and portfolio managers to understand their performance better by providing them with in-depth analytics and risk metrics.


QuantStats is comprised of 3 main modules:

  1. quantstats.stats - for calculating various performance metrics, like Sharpe ratio, Win rate, Volatility, etc.
  2. quantstats.plots - for visualizing performance, drawdowns, rolling statistics, monthly returns, etc.
  3. quantstats.reports - for generating metrics reports, batch plotting, and creating tear sheets that can be saved as an HTML file.

Here's an example of a simple tear sheet analyzing a strategy:

Quick Start

%matplotlib inline
import quantstats as qs

# extend pandas functionality with metrics, etc.

# fetch the daily returns for a stock
stock = qs.utils.download_returns('FB')

# show sharpe ratio

# or using extend_pandas() :)



Visualize stock performance

qs.plots.snapshot(stock, title='Facebook Performance')

# can also be called via:
# stock.plot_snapshot(title='Facebook Performance')


Snapshot plot

Creating a report

You can create 7 different report tearsheets:

  1. qs.reports.metrics(mode='basic|full", ...) - shows basic/full metrics
  2. qs.reports.plots(mode='basic|full", ...) - shows basic/full plots
  3. qs.reports.basic(...) - shows basic metrics and plots
  4. qs.reports.full(...) - shows full metrics and plots
  5. qs.reports.html(...) - generates a complete report as html

Let' create an html tearsheet

(benchmark can be a pandas Series or ticker)
qs.reports.html(stock, "SPY")

Output will generate something like this:

HTML tearsheet

(view original html file)

To view a complete list of available methods, run

[f for f in dir(qs.stats) if f[0] != '_']
[f for f in dir(qs.plots) if f[0] != '_']

*** Full documenttion coming soon ***

In the meantime, you can get insights as to optional parameters for each method, by using Python's help method:

Help on function conditional_value_at_risk in module quantstats.stats:

conditional_value_at_risk(returns, sigma=1, confidence=0.99)
    calculats the conditional daily value-at-risk (aka expected shortfall)
    quantifies the amount of tail risk an investment


Install using pip:

$ pip install quantstats --upgrade --no-cache-dir

Install using conda:

$ conda install -c ranaroussi quantstats



This is a new library... If you find a bug, please open an issue in this repository.

If you'd like to contribute, a great place to look is the issues marked with help-wanted.

Known Issues

For some reason, I couldn't find a way to tell seaborn not to return the monthly returns heatmap when instructed to save - so even if you save the plot (by passing savefig={...}) it will still show the plot.

Legal Stuff

QuantStats is distributed under the Apache Software License. See the LICENSE.txt file in the release for details.


Please drop me a note with any feedback you have.

Ran Aroussi

Popular Portfolio Projects
Popular Visualization Projects
Popular Content Management Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Algorithmic Trading
Quantitative Finance
Quantitative Trading