Overall Statistics
Total Trades
59
Average Win
0.21%
Average Loss
-0.01%
Compounding Annual Return
12.509%
Drawdown
16.600%
Expectancy
14.506
Net Profit
1.991%
Sharpe Ratio
0.655
Probabilistic Sharpe Ratio
43.602%
Loss Rate
8%
Win Rate
92%
Profit-Loss Ratio
15.92
Alpha
-0.035
Beta
1.846
Annual Standard Deviation
0.311
Annual Variance
0.097
Information Ratio
0.306
Tracking Error
0.244
Treynor Ratio
0.11
Total Fees
$59.00
Estimated Strategy Capacity
$12000000.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(30, Resolution.Daily)                
                        
        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.Every(timedelta(minutes=1)), self.EveryDayAfterMarketOpen)
            
            
    def EveryDayAfterMarketOpen(self):
        if self.IsWarmingUp: 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)
             
            if invested and nowprice > aveprice * 1.05 or nowprice < aveprice * 0.7: 
                self.Liquidate(symbol)
     

class SymbolData:
    def __init__ (self,algo,symbol):
        self.algorithm = algo
        self.symbol = symbol