Overall Statistics
Total Trades
5956
Average Win
0.12%
Average Loss
-0.06%
Compounding Annual Return
11.436%
Drawdown
34.200%
Expectancy
0.654
Net Profit
247.019%
Sharpe Ratio
0.729
Probabilistic Sharpe Ratio
13.076%
Loss Rate
42%
Win Rate
58%
Profit-Loss Ratio
1.86
Alpha
0.114
Beta
-0.069
Annual Standard Deviation
0.143
Annual Variance
0.021
Information Ratio
-0.126
Tracking Error
0.219
Treynor Ratio
-1.512
Total Fees
$5956.00
Estimated Strategy Capacity
$34000000.00
Lowest Capacity Asset
EBAYL W8R4ZT6D4G9X
class TransdimensionalCalibratedChamber(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2010, 1, 1)  # Set Start Date
        #self.SetEndDate(2021, 1, 1)
        self.SetCash(10000)  # 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)