Overall Statistics |
Total Trades 2113 Average Win 1.09% Average Loss -1.28% Compounding Annual Return -5.560% Drawdown 89.800% Expectancy -0.084 Net Profit -61.309% Sharpe Ratio 0.046 Probabilistic Sharpe Ratio 0.002% Loss Rate 50% Win Rate 50% Profit-Loss Ratio 0.85 Alpha -0.031 Beta 0.836 Annual Standard Deviation 0.261 Annual Variance 0.068 Information Ratio -0.182 Tracking Error 0.216 Treynor Ratio 0.014 Total Fees $2188.16 |
class SwimmingFluorescentYellowLemur(QCAlgorithm): def Initialize(self): self.SetStartDate(2000, 1, 1) # Set Start Date self.SetEndDate(2020,1,1) self.SetCash(100000) # Set Strategy Cash # self.AddEquity("SPY", Resolution.Minute) self.month = None self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction) def CoarseSelectionFunction(self, coarse): highdollarvol = [x.Symbol for x in coarse if x.Price > 10 and x.DollarVolume > 2000000] return highdollarvol def FineSelectionFunction(self, fine): Tech_stocks = [x for x in fine if x.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.Technology] nonprofitable = sorted([x for x in fine if x.FinancialStatements.IncomeStatement.NormalizedIncome.OneMonth <= 0], key = lambda x: x.FinancialStatements.IncomeStatement.TotalRevenue.OneMonth, reverse = True) return [x.Symbol for x in nonprofitable[:50]] # def OnData(self, data): # stocks = data.Keys # num_stocks = len(stocks) # for s in stocks: # if self.Portfolio[s].IsInvested: # self.SetHoldings(s, 1/num_stocks) def OnSecuritiesChanged(self, changes): if self.month == self.Time.month: return self.month = self.Time.month self.changes = changes self.Log(f"OnSecuritiesChanged({self.Time}):: {changes}") for security in self.changes.RemovedSecurities: if security.Invested: self.Liquidate(security.Symbol) for security in self.changes.AddedSecurities: #2. Leave a cash buffer by setting the allocation to 0.18 instead of 0.2 self.SetHoldings(security.Symbol, 0.01)