Question 1: How to filter stocks by Float (shares available for trading)?
I want to filter for low float stocks (max 10 million shares). What's the correct way to access float data in FineSelectionFunction? Is it SharesOutstanding or is there a specific Float field?
def FineSelectionFunction(self, fine):
fine = list(fine)
filtered = []
for x in fine:
# How to get Float? Is this correct?
shares = x.CompanyProfile.SharesOutstanding
if shares and shares > 0 and shares <= 10000000:
filtered.append(x)
return [x.Symbol for x in filtered]
Question 2: Why is my algorithm not executing any trades?
My algorithm runs without errors but executes 0 trades. I'm using:
• CoarseSelectionFunction (price $0.5-$15, volume > 20000)
• FineSelectionFunction (market cap $5M-$100M)
• Scheduled scans at 9:45, 10:30, 12:00, 14:00
The scan runs but stock_data dictionary seems empty. What am I missing?
def OnSecuritiesChanged(self, changes):
for security in changes.AddedSecurities:
symbol = security.Symbol
if symbol not in self.stock_data:
self.stock_data[symbol] = {
'prices': RollingWindow[TradeBar](20),
'added_date': self.Time
}
def OnData(self, data):
for symbol in self.stock_data:
if data.Bars.ContainsKey(symbol):
self.stock_data[symbol]['prices'].Add(data.Bars[symbol])
Question 3: How to properly use Universe Selection with Daily resolution?
I set self.UniverseSettings.Resolution = Resolution.Daily but my RollingWindow never fills up. Do I need to request history manually? How do I warm up data for universe stocks?
self.UniverseSettings.Resolution = Resolution.Daily
self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)
self.SetWarmUp(timedelta(days=20))
Question 4: What fundamental data is available for small cap stocks ($5M-$100M market cap)?
I'm targeting micro-cap stocks but many seem to have missing data. Which fields are reliably available?
• MarketCap
• SharesOutstanding
• Float
• Volume
Question 5: How to debug why no stocks pass my filters?
How can I log how many stocks pass each filter stage? My Debug statements don't appear in backtest logs.
def CoarseSelectionFunction(self, coarse):
filtered = [x for x in coarse if
x.HasFundamentalData and
self.min_price <= x.Price <= self.max_price and
x.Volume >= 20000]
self.Debug(f"Coarse: {len(filtered)} passed") # This doesn't show in logs
return [x.Symbol for x in filtered[:300]]
Mutlaq
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!