Overall Statistics
Total Trades
85
Average Win
12.65%
Average Loss
-7.57%
Compounding Annual Return
6.917%
Drawdown
56.100%
Expectancy
0.564
Net Profit
309.990%
Sharpe Ratio
0.412
Probabilistic Sharpe Ratio
0.118%
Loss Rate
41%
Win Rate
59%
Profit-Loss Ratio
1.67
Alpha
0.08
Beta
-0.093
Annual Standard Deviation
0.179
Annual Variance
0.032
Information Ratio
0.017
Tracking Error
0.263
Treynor Ratio
-0.797
Total Fees
$633.16
# https://quantpedia.com/strategies/january-effect-in-stocks/
#
# Invest in small-cap stocks at the beginning of each January. Stay invested in large-cap stocks for the rest of the year.
#
# QC implementation changes:
#   - Small cap etf (IWM) and large cap etf (SPY) are used as investment assets.

class JanuaryEffectInStocks(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2000, 1, 1)  
        self.SetCash(100000) 

        self.large_cap = self.AddEquity('SPY', Resolution.Daily).Symbol
        self.small_cap = self.AddEquity('IWM', Resolution.Daily).Symbol
        
        self.Schedule.On(self.DateRules.MonthStart(self.large_cap), self.TimeRules.AfterMarketOpen(self.large_cap), self.Rebalance)
    
    def Rebalance(self):
        if self.Time.month == 1:
            if self.Portfolio[self.large_cap].Invested:
                self.Liquidate(self.large_cap)
            self.SetHoldings(self.small_cap, 1)
        else:
            if self.Portfolio[self.small_cap].Invested:
                self.Liquidate(self.small_cap)
            self.SetHoldings(self.large_cap, 1)