In the last chapter, we introduced zipline to simulate the computation of alpha factors from trailing cross-sectional market, fundamental, and alternative data. Now we will exploit the alpha factors to derive and act on buy and sell signals. We will postpone optimizing the portfolio weights until later in this chapter, and for now, just assign positions of equal value to each holding. The code for this section is in the 01_trading_zipline subdirectory.
How to build and test a portfolio with zipline
Scheduled trading and portfolio rebalancing
We will use the custom MeanReversion factor developed in the last chapter—see the implementation in alpha_factor_zipline_with_trades.py.
The Pipeline created by the compute_factors...