Overall Statistics
Total Trades
11034
Average Win
0.14%
Average Loss
-0.11%
Compounding Annual Return
10.146%
Drawdown
60.000%
Expectancy
0.342
Net Profit
659.343%
Sharpe Ratio
0.539
Probabilistic Sharpe Ratio
0.745%
Loss Rate
40%
Win Rate
60%
Profit-Loss Ratio
1.24
Alpha
0.108
Beta
-0.081
Annual Standard Deviation
0.191
Annual Variance
0.036
Information Ratio
0.122
Tracking Error
0.27
Treynor Ratio
-1.274
Total Fees
$11670.92
class TransdimensionalCalibratedChamber(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2000, 1, 1)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        self.market = self.AddEquity("SPY", Resolution.Daily).Symbol
        
        self.AddUniverseSelection(
           FineFundamentalUniverseSelectionModel(self.SelectCoarse, self.SelectFine)
        )
        
        self.UniverseSettings.Resolution = Resolution.Daily
        
        self.in_consumer = True
        
        self.consumer_months = [11, 12, 1, 2, 3]

    def SelectCoarse(self, coarse):
        if self.Time.month not in self.consumer_months or (self.in_consumer and self.Portfolio.Invested):
            return []
        return [c.Symbol for c in coarse if c.Price > 5]
        
    def SelectFine(self, fine):
        return [x.Symbol for x in fine if x.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.ConsumerCyclical]

    def into_market(self):
        self.Liquidate()
        self.SetHoldings(self.market, 1)
        self.in_consumer = False
    
    def into_consumer(self, securities):
        self.Liquidate()
        for s in securities:
            self.SetHoldings(s, 1 / len(securities))
        self.in_consumer = True
    
    
    def OnData(self, data):
        if self.Time.month not in self.consumer_months:
            if self.in_consumer:
                self.into_market()
            return
        
        securities = [s for s in data.Keys if s != self.market]
        
        if len(securities) < 1 or (self.in_consumer and self.Portfolio.Invested):
            return
        
        self.into_consumer(securities)