Overall Statistics
Total Trades
43
Average Win
8.22%
Average Loss
-8.30%
Compounding Annual Return
5.181%
Drawdown
36.600%
Expectancy
0.611
Net Profit
204.103%
Sharpe Ratio
0.404
Probabilistic Sharpe Ratio
0.094%
Loss Rate
19%
Win Rate
81%
Profit-Loss Ratio
0.99
Alpha
0.055
Beta
-0.059
Annual Standard Deviation
0.126
Annual Variance
0.016
Information Ratio
-0.107
Tracking Error
0.225
Treynor Ratio
-0.861
Total Fees
$258.45
# 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)

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)
        self.startPrice = None
        
    def Rebalance(self):
        if self.Time.month == 5:
            self.Liquidate("SPY")
        if self.Time.month == 11:
            self.SetHoldings("SPY", 1)