def coarse_selection(self, coarse):
def ok(c):
if not c.HasFundamentalData: return False
if c.Price is None or c.Price <= px_min: return False
# Prefer coarse DollarVolume if available; fall back to Price*Volume if needed
dv = getattr(c, 'DollarVolume', None)
if dv is None or dv <= 0:
if c.Volume is None: return False
dv = c.Price * c.Volume
if dv <= dv_min: return False
sv = c.Symbol.Value
if ' ' in sv: return False
return True
filtered = (c for c in coarse if ok(c))
Mia Alissi
How this helps Dharmesh:
coarseuniverse stocks for minimum price, minimum dollar volume, presence of fundamental data, and no spaces in tickers.dollar_volumeand falls back toprice * volumeif needed.number_of_symbols_coarse,_px_min, and_dv_minwhen initializing your universe model.Sources: Q C500 Universe Selection Model, Fundamental Universes - QuantConnect.com, docs writing algorithms algorithm framework universe selection key concepts, Greenblatt Magic Formula Alpha, Legacy Fundamental Universes - QuantConnect.com
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Dharmesh Khalasi
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!