Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Best and worst stocks by PE ratio for each sector

How could I build a CustomFactor() that would select stocks that correspond to the highest and lowest fundamental data, say PE ratio, for each sector? Or maybe two CustomFactors: one to give me the tops and the other to give the bottom ones. That will be easier for me to work with longs and shorts inside pipeline. Any suggestion?

2 responses

Does it have to be a custom factor? Here's a solution without one, implementing it in a custom factor would be a little more complicated...

Thanks, Tentor.

That's definitely much simpler and does the trick.