Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
I'm not getting all Sectors

I'm trying to get the most traded securities in each sector. According to docs there are 11 sectors total. Why am I getting less than 11?

1 response

You should change the line

most_traded = USEquityPricing.volume.latest.top(2, groupby=Sector())  

to add the same mask used when defining the pipeline. Like this

most_traded = USEquityPricing.volume.latest.top(2, groupby=Sector(), mask=QTradableStocksUS())  

What was happening was the most_traded filter included some securities which were not in QTradableStocksUS(). When the pipeline ran, those were filtered out. See attached notebook. Now 11 sectors show up for both the total results and the 'most_traded' results.