I'm trying to make a simple equity screener that keeps stocks that cost < $10 from 5 days ago so I can eventually build more complicated screeners based on history data. When I run the code below over a 10 day backtest, it doesn't finish after 10 minutes, so I stopped it. Any recommendations on quicklly screening the full equity database? from clr import AddReference AddReference("System") AddReference("QuantConnect.Algorithm") AddReference("QuantConnect.Indicators") AddReference("QuantConnect.Common") from System import * from QuantConnect import * from QuantConnect.Data import * from QuantConnect.Algorithm import * from QuantConnect.Indicators import * from System.Collections.Generic import List import decimal as d ### <summary> ### In this algorithm we demonstrate how to perform some technical analysis as ### part of your coarse fundamental universe selection ### </summary> ### <meta name="tag" content="using data" /> ### <meta name="tag" content="indicators" /> ### <meta name="tag" content="universes" /> ### <meta name="tag" content="coarse universes" /> class TestAlgorithm(QCAlgorithm): def Initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' self.SetStartDate(2010,01,01) #Set Start Date self.SetEndDate(2010,01,10) #Set End Date self.SetCash(100000) #Set Strategy Cash self.UniverseSettings.Resolution = Resolution.Daily self.AddUniverse(self.CoarseSelectionFunction) def CoarseSelectionFunction(self, coarse): '''select for all U.S. stocks where share price from 5 days ago was <$10''' matchingSymbols = [] for cf in coarse: self.AddSecurity(SecurityType.Equity, cf.Symbol.Value) hist = self.History(cf.Symbol.Value,5,Resolution.Daily) if hist['close'][0] <10: matchingSymbols.append(cf.Symbol) return matchingSymbols # this event fires whenever we have changes to our universe def OnSecuritiesChanged(self, changes): # liquidate removed securities for security in changes.RemovedSecurities: if security.Invested: self.Liquidate(security.Symbol) for security in changes.AddedSecurities: self.SetHoldings(security.Symbol, 0.1)