Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
import time class Filters(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 8, 19) self.SetStartDate(2019, 8, 20) self.SetCash(10000) self.UniverseSettings.Resolution= Resolution.Minute self.AddUniverse(self.coarseFilter, self.fineFilter) self.priceTarget= [1,10] self.aveDailyVol = {} self.lastClose = {} def coarseFilter(self, coarse): result = [x.Symbol for x in coarse if (x.HasFundamentalData and x.AdjustedPrice > self.priceTarget[0] and x.AdjustedPrice < self.priceTarget[1])] self.Debug("number of coarse results: {}".format(len(result))) return [x for x in result] def fineFilter(self,fine): result = [x.Symbol for x in fine if x.EarningReports.BasicAverageShares.OneMonth < 10e06] self.Debug("number of fine results: {}".format(len(result))) start = time.time() for symbol in result: history = self.History([symbol], 15, Resolution.Daily) if history.empty: result.remove(symbol) continue self.aveDailyVol[symbol] = history.volume.mean() self.lastClose[symbol] = history.close[-1] end = time.time() self.Debug("it took {} to run".format(end-start)) return result def OnData(self, data): pass