Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Multi-sector screen?

Hi, I was trying to make a screen in my pipeline with multiple sectors, but still keeping my Q1500US() universe (base_universe) for liquid stocks (is_liquid) still in place, in this way:

 securities_to_trade = (base_universe & is_liquid & ((fundamentals.asset_classification.morningstar_sector_code == 301) | (fundamentals.asset_classification.morningstar_sector_code == 310) | (fundamentals.asset_classification.morningstar_sector_code == 207) | (fundamentals.asset_classification.morningstar_sector_code == 309) | (fundamentals.asset_classification.morningstar_sector_code == 206) | (fundamentals.asset_classification.morningstar_sector_code == 103)))  

However, it keeps giving me this error:

TypeError: init() takes exactly 4 arguments (3 given)

How can I solve the issue?
Thanks in advance

1 response

Try this...

# Import the basic built in classifier for Sector  
from quantopian.pipeline.classifiers.fundamentals import Sector


# Use the '.element_of' method for the sectors you want  
securities_to_trade = base_universe & is_liquid & Sector().element_of( [103, 206, 207, 301, 309, 310])