Overall Statistics |
Total Trades 73 Average Win 0.08% Average Loss -0.02% Compounding Annual Return -1.463% Drawdown 9.500% Expectancy 2.493 Net Profit -0.249% Sharpe Ratio -0.013 Probabilistic Sharpe Ratio 33.960% Loss Rate 35% Win Rate 65% Profit-Loss Ratio 4.37 Alpha -0.123 Beta 0.981 Annual Standard Deviation 0.16 Annual Variance 0.026 Information Ratio -1.115 Tracking Error 0.112 Treynor Ratio -0.002 Total Fees $73.00 Estimated Strategy Capacity $45000000.00 Lowest Capacity Asset BRKB R735QTJ8XC9X |
class BasicTemplateAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2021,4,29) self.SetCash(10000) self.Data_Symbol = {} tickers = ["SPY","AAPL","MSFT", "AMZN", "GOOGL", "FB", "TSLA","BRK.B","BABA", "TSM", "V","NVDA","JPM", "JNJ", "WMT", "UNH", "MA","BAC","PYPL", "HD", "PG","DIS","ASML", "ADBE", "CMCSA", "NKE", "NFLX","KO","VZ", "INTC", "AVGR"] self.SetWarmUp(timedelta(days=30)) for stock in tickers: symbol = self.AddEquity(stock, Resolution.Minute).Symbol self.Data_Symbol[symbol] = SymbolData(self, symbol) self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.At(23, 59), self.DayEnd) self.state = {sym: False for sym in self.Data_Symbol.keys()} def DayEnd(self): for sym in self.Data_Symbol.keys(): self.state[sym] = False def OnData(self, data): if self.IsWarmingUp: return for symbol, symbol_data in self.Data_Symbol.items(): if self.state[symbol]: continue holdings = self.Portfolio[symbol] invested = holdings.Invested nowprice = holdings.Price aveprice = holdings.AveragePrice quantity = holdings.Quantity bpower = self.Portfolio.Cash if not invested and bpower > nowprice: self.MarketOrder(symbol, 1) if self.LiveMode: self.Log(f'{symbol} bought on {self.Time}') if invested and nowprice < aveprice * 0.95 and bpower > nowprice: self.MarketOrder(symbol, quantity + 1) self.state[symbol] = True if invested and nowprice > aveprice * 1.05 or nowprice < aveprice * 0.7: self.Liquidate(symbol) self.state[symbol] = True class SymbolData: def __init__ (self,algo,symbol): self.algorithm = algo self.symbol = symbol