Back to Community
Not getting correct results from Pipeline filtered by MarketCap

Hi,

I am using the default_us_equity_universe_mask() which is returning about 2333 assets by itself. Now, I would like to get the bottom 50% by MarketCap, so have used the percentile_between() method as shown in the attached notebook. But it returns only 224 assets. Any idea why?

Thanks.

Loading notebook preview...
Notebook previews are currently unavailable.
2 responses

Add a mask to your MarketCap factor.

universe = (MarketCap(mask=default_us_equity_universe_mask()).percentile_between(0, 50))

Without that mask,MarketCap().percentile_between(0, 50) is looking at all (8000+) assets, and then returning the bottom 50%. You were then taking only those assets in BOTH this result AND 'default_us_equity_universe_mask()'. What you wanted was first start with the 'default_us_equity_universe_mask()', then take those in the bottom 50% of market cap. This can be done with the mask parameter as shown above.

Loading notebook preview...
Notebook previews are currently unavailable.

Thank you, Dan. Works perfectly with this change!