Overall Statistics
Total Orders
50
Average Win
9.88%
Average Loss
-8.57%
Compounding Annual Return
5.650%
Drawdown
36.600%
Expectancy
0.723
Start Equity
100000
End Equity
404832.92
Net Profit
304.833%
Sharpe Ratio
0.21
Sortino Ratio
0.153
Probabilistic Sharpe Ratio
0.012%
Loss Rate
20%
Win Rate
80%
Profit-Loss Ratio
1.15
Alpha
0.001
Beta
0.506
Annual Standard Deviation
0.113
Annual Variance
0.013
Information Ratio
-0.19
Tracking Error
0.112
Treynor Ratio
0.047
Total Fees
$300.17
Estimated Strategy Capacity
$710000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
Portfolio Turnover
0.54%
# 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)