Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Value composite 2 (VC2) attempt

I'm trying to get a hang of this pipeline business. It's a steep learning curve because I can't debug it by peeking into dataframes at every step. At any rate, could someone knowledgeable and generous review my code and tell me if it's actually doing what I'm asking it to do which is to sum the rank of all the ratios and return the best ranked 20 stocks?

Also, it's really slow, is there any way to improve the speed?

Is it also possible instead of ranking, to provide a percentile?

3 responses

Try some of these things in code and notice the inset run times and start dates. This one was 18 minutes, how does that compare?

Thanks Gary,

How come you chose to use the * operator for combining the ranks? Would this line be pooling all ratios by multiplication then ranking the product? I feel that if that were the case, we would need to normalise the ratios first.

Normalizing first would be good. I had a version (that wound up deleted, I meant to include it) with all of the fundamentals as columns and could see that the very large values were the ones that would always matter in ranking, some of the smaller value columns wouldn't be significant in addition. Preferably normalize in make_pipeline() I think. I had normalized in before_trading_start with: normalized = out.div(out.sum(axis=0), axis=1) and that works fine, however then wanted to sum each row, and normalized.sum(axis=1) hit an unknown error.