(Credit to: "Aqua Rooster", link in the algo)

This is a class of stat arb algos that I have not seen yet in QuantConnect (which just featured pairs trading algos so far). 

It consists of the following steps:

1. Select shares universe (e.g. i. a static list or ii. a dynamic one, like most liquid shares in same sector)
   and get historical prices

2. Find risk factors (i.e. common drivers for the returns), using e.g. PCA, ICA, ...

3. Regress returns vs. risk factors to get individual factor exposure (betas)

4. find shares weights such that 
        i.  maximise your alpha (e.g. z-score of regression residuals * weights) 
        ii. subject to some constraints, e.g. 
                zero net exposure, 
                gross exposure <= 100%, 
                neutralised betas 

 

Algo is mostly a copy & cut from Quantopian. But it is difficult to run in QC (with, say, 500 shares) since memory gets quickly maxed out. Any suggestions there?