| Overall Statistics |
|
Total Trades 69 Average Win 0.09% Average Loss -0.02% Compounding Annual Return 1.236% Drawdown 9.300% Expectancy 2.752 Net Profit 0.208% Sharpe Ratio 0.157 Probabilistic Sharpe Ratio 36.535% Loss Rate 32% Win Rate 68% Profit-Loss Ratio 4.48 Alpha -0.099 Beta 1.009 Annual Standard Deviation 0.162 Annual Variance 0.026 Information Ratio -0.884 Tracking Error 0.111 Treynor Ratio 0.025 Total Fees $69.27 Estimated Strategy Capacity $38000000.00 Lowest Capacity Asset AVGR VXOCXY104W9X |
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 = False
def DayEnd(self):
self.state = False
def OnData(self, data):
if self.IsWarmingUp or self.state: return
for symbol, symbol_data in self.Data_Symbol.items():
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 = True
if invested and nowprice > aveprice * 1.05 or nowprice < aveprice * 0.7:
self.Liquidate(symbol)
self.state = True
class SymbolData:
def __init__ (self,algo,symbol):
self.algorithm = algo
self.symbol = symbol