You’re part of a group

Switch to your group space and start collaborating with your teammates.

You’re part of a group

Switch to your group space and start collaborating with your teammates.














Sign up
Workspace
Andy Ly/

Quantstats

0
Beta
Spinner
!pip install QuantStats
# https://github.com/ranaroussi/quantstats
%matplotlib inline
import quantstats as qs

# extend pandas functionality with metrics, etc.
qs.extend_pandas()

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

# show sharpe ratio
qs.stats.sharpe(stock)

# or using extend_pandas() :)
stock.sharpe()

# qs.plots.snapshot(stock, title='Amazon Performance', show=True)

# can also be called via:
# stock.plot_snapshot(title='Facebook Performance', show=True)
# benchmark can be a pandas Series or ticker
qs.reports.html(stock, "SPY")
# qs.reports.metrics(stock,"SPY") # - shows basic/full metrics
# qs.reports.plots(stock, "SPY") #- shows basic/full plots
qs.reports.basic(stock,"SPY") # - shows basic metrics and plots
# qs.reports.full(stock, 'SPY"') # - shows full metrics and plots
# qs.reports.html(...) # - generates a complete report as html
# Let' create an html tearsheet
  • AI Chat
  • Code