Overall Statistics
Total Trades
46
Average Win
9.36%
Average Loss
-8.57%
Compounding Annual Return
4.842%
Drawdown
36.600%
Expectancy
0.636
Net Profit
208.871%
Sharpe Ratio
0.351
Probabilistic Sharpe Ratio
0.006%
Loss Rate
22%
Win Rate
78%
Profit-Loss Ratio
1.09
Alpha
0.01
Beta
0.498
Annual Standard Deviation
0.114
Annual Variance
0.013
Information Ratio
-0.179
Tracking Error
0.114
Treynor Ratio
0.08
Total Fees
$277.81
Estimated Strategy Capacity
$630000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# https://quantpedia.com/strategies/market-seasonality-effect-in-world-equity-indexes/
#
# Be invested in global equity markets during November – April period, stay in cash during May-October period (alternatively go
# long in stocks from countries from northern hemisphere during winter period and long in stocks from countries from southern hemisphere
# during summer period; alternatively go long in cyclical companies during winter period and short defensive stocks and switch positions
# during the summer period)

from AlgorithmImports import *

class SeasonalityInEquitiesAlgorithm(QCAlgorithm):

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

        self.AddEquity("SPY", Resolution.Daily)
        self.AddEquity("SHY", Resolution.Daily)
        
        self.Schedule.On(self.DateRules.MonthStart("SPY"), self.TimeRules.AfterMarketOpen("SPY"), self.Rebalance)
        
    def Rebalance(self):
        if self.Time.month == 5:
            self.Liquidate("SPY")
        if self.Time.month == 11:
            self.SetHoldings("SPY", 1)