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
- Sector Analysis
With a signal and pricing data creating a factor "tear sheet" is just:
import alphalens
alphalens.tears.create_factor_tear_sheet(my_factor, pricing)
Check out the example notebooks for more on how to read and use the factor tear sheet.
pip install alphalens
Alphalens depends on:
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.
If you find a bug, feel free to open an issue on our github tracker.
If you want to contribute, a great place to start would be the help-wanted issues.
- Andrew Campbell
- James Christopher
- Thomas Wiecki
- Jonathan Larkin
- Jessica Stauth (jstauth@quantopian.com)
- Taso Petridis
For a full list of contributors see the contributors page.
Example factor courtesy of ExtractAlpha