Using zipline and ta-lib to create input data for alphalens

Quantopian's open source python stock trading simulator zipline is very powerful and now comes with a mechanism to run daily bar simulations against over 3000 symbols from the quandl library.  It also provides flexible support to many libraries including classic technical analysis indicators.   Now a new tool can be used to more formally evaluate your trading signal.


As described by the authors, " 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."


Here is an example jupyter notebook that demonstrates how to use zipline to create the two python pandas objects that are used as input to alphalens.  As a test, it uses the ta-lib "Accumulate/Distribute Oscillator" against the Dow 30 stocks for 400 trading days to see if this classic technical indicator has predictive value. 


Here is just a tiny snapshot of one of the many graphs that are created with a run of the tool:




Spoiler alert : It doesn't look like this indicator is working that great.  See the notebook for all the details.