from zipline.pipeline import master, EquityPricing
def CommonStocks():
"""
Return a Pipeline filter that is limited to domestic common stocks, excluding
secondary shares. This filter is intended to be used as the initial_universe
of the Pipeline.
"""
category = master.SecuritiesMaster.sharadar_Category.latest
common_stocks = (
category.has_substring("Domestic Common")
& ~category.has_substring("Secondary")
)
return common_stocks
def BaseUniverse():
"""
Return a Pipeline filter that excludes illiquid stocks and penny stocks.
This filter is intended to be used as the screen of the Pipeline or the
mask of factors in the Pipeline.
"""
base_universe = (EquityPricing.volume.latest > 0).all(21)
base_universe = (EquityPricing.close.latest > 1.00).all(21, mask=base_universe)
return base_universe