Ideally, it should have selected 10-15 mean reverting stocks from a universe of 30-40 stocks but quantopian does not scale :(
What is the problem? Time-out? Memory? Other? If it is timing out, you could consider running your code in
before_trading_start, where you'll have 5X more time.
Also, what does your code do? Would you provide a little lecture on the overall concept and the major steps. I'll try to go back to the original paper, but as is typical, there's little explanation of the basic concepts at an intuitive level. For example, are we talking about finding a handful of stocks, with some expected to revert in price upward and some expected to revert in price downward; hence we would know which to long and which to short, and in what proportion? Or are we forming two baskets that are statistically related to one another (e.g. pair trading, except with a long basket and a short basket)? Something else altogether?