Overall Statistics
Total Trades
85
Average Win
12.36%
Average Loss
-7.57%
Compounding Annual Return
7.630%
Drawdown
56.100%
Expectancy
0.568
Net Profit
389.345%
Sharpe Ratio
0.446
Probabilistic Sharpe Ratio
0.180%
Loss Rate
40%
Win Rate
60%
Profit-Loss Ratio
1.63
Alpha
0.086
Beta
-0.092
Annual Standard Deviation
0.178
Annual Variance
0.032
Information Ratio
0.017
Tracking Error
0.261
Treynor Ratio
-0.866
Total Fees
$650.44
Estimated Strategy Capacity
$480000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# 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)