Skip to main content

Performance analysis of predictive (alpha) stock factors

Project description

https://media.quantopian.com/logos/open_source/alphalens-logo-03.png

Alphalens

https://travis-ci.org/quantopian/alphalens.svg?branch=master

Alphalens is a Python Library for performance analysis of predictive (alpha) stock factors. Alphalens works great with the Zipline open source backtesting library, and Pyfolio which provides performance and risk analysis of financial portfolios.

The main function of Alphalens is to surface the most relevant statistics and plots about an alpha factor, including:

  • Returns Analysis

  • Information Coefficient Analysis

  • Turnover Analysis

  • Grouped Analysis

Getting started

With a signal and pricing data creating a factor “tear sheet” is a two step process:

import alphalens

# Ingest and format data
factor_data = alphalens.utils.get_clean_factor_and_forward_returns(my_factor,
                                                                   pricing,
                                                                   quantiles=5,
                                                                   groupby=ticker_sector,
                                                                   groupby_labels=sector_names)

# Run analysis
alphalens.tears.create_full_tear_sheet(factor_data)

Learn more

Check out the example notebooks for more on how to read and use the factor tear sheet.

Installation

Install with pip:

pip install alphalens

Install with conda:

conda install -c conda-forge alphalens

Install from the master branch of Alphalens repository (development code):

pip install git+https://github.com/quantopian/alphalens

Alphalens depends on:

Usage

A good way to get started is to run the examples in a Jupyter notebook.

To get set up with an example, you can:

Run a Jupyter notebook server via:

jupyter notebook

From the notebook list page(usually found at http://localhost:8888/), navigate over to the examples directory, and open any file with a .ipynb extension.

Execute the code in a notebook cell by clicking on it and hitting Shift+Enter.

Questions?

If you find a bug, feel free to open an issue on our github tracker.

Contribute

If you want to contribute, a great place to start would be the help-wanted issues.

Credits

For a full list of contributors see the contributors page.

Example Tear Sheet

Example factor courtesy of ExtractAlpha

https://github.com/quantopian/alphalens/raw/master/alphalens/examples/table_tear.png https://github.com/quantopian/alphalens/raw/master/alphalens/examples/returns_tear.png https://github.com/quantopian/alphalens/raw/master/alphalens/examples/ic_tear.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alphalens-0.3.6.tar.gz (18.9 MB view details)

Uploaded Source

File details

Details for the file alphalens-0.3.6.tar.gz.

File metadata

  • Download URL: alphalens-0.3.6.tar.gz
  • Upload date:
  • Size: 18.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/2.7.13

File hashes

Hashes for alphalens-0.3.6.tar.gz
Algorithm Hash digest
SHA256 5fdd72a8a6845e9e728389a0388734df3815acf6ef04551ecc09040de468f6a2
MD5 776b08afb0f7becbb689422d8108c451
BLAKE2b-256 2708b14d68628254ad2b32a5e95c75c1288c929861125b4b06c35cae50bedfad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page