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
Probabilistic 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.307
Tracking Error
0.15
Treynor Ratio
0
Total Fees
$0.00
class JumpingYellowGreenChicken(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 1, 6)
        
        etf_tickers = ["XLB","XLE","XLF","XLI","XLK","XLP","XLU","XLV","XLY"]
        
        for ticker in etf_tickers:
            symbol = self.AddEquity(ticker, Resolution.Daily).Symbol
            self.Securities[symbol].SetDataNormalizationMode(DataNormalizationMode.TotalReturn)
            self.Consolidate(symbol, Calendar.Monthly, self.CalendarTradeBarHandler)
            self.Securities[symbol].SetLeverage(1.0) #Leverage is set to 1 to ensure no margin used
        
        historydate = datetime.date(datetime.now()) - datetime.date(datetime(1998,12,23))
        self.history_days = int(historydate.days)+1
        
        self.history_df = self.History(etf_tickers,timedelta(days=self.history_days),Resolution.Daily)

        self.Log(f"History call 1: {self.history_df.shape}")

        self.history_df = self.History(self.Securities.Keys,timedelta(days=self.history_days),Resolution.Daily)
        
        self.Log(f"History call 2: {self.history_df.shape}")

        #tester = True
        #
        #while tester == True:
        #    if self.history_df.empty == True:
        #        self.history_df = self.History(self.Securities.Keys,timedelta(days=self.history_days),Resolution.Daily)
        #    elif self.history_df.empty == False:
        #        tester=False
    
    def CalendarTradeBarHandler(self, consolidated):
        return