Created with Highcharts 12.1.2Equity2000200220042006200820102012201420162018202020222024202650k100k150k200k250k300k350k400k450k500k
Overall Statistics
Total Orders
51
Average Win
9.88%
Average Loss
-8.57%
Compounding Annual Return
5.426%
Drawdown
36.600%
Expectancy
0.722
Start Equity
100000
End Equity
400672.79
Net Profit
300.673%
Sharpe Ratio
0.188
Sortino Ratio
0.137
Probabilistic Sharpe Ratio
0.007%
Loss Rate
20%
Win Rate
80%
Profit-Loss Ratio
1.15
Alpha
-0.001
Beta
0.507
Annual Standard Deviation
0.112
Annual Variance
0.013
Information Ratio
-0.207
Tracking Error
0.111
Treynor Ratio
0.042
Total Fees
$307.53
Estimated Strategy Capacity
$0
Lowest Capacity Asset
SPY R735QTJ8XC9X
Portfolio Turnover
0.53%
# 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.set_start_date(1999, 1, 1)  
        self.set_cash(100000) 

        self.symbol: Symbol = self.add_equity("SPY", Resolution.DAILY).symbol
        
        self.schedule.on(self.date_rules.month_start(self.symbol), self.time_rules.after_market_open(self.symbol), self.rebalance)
        
    def rebalance(self) -> None:
        if self.time.month == 5:
            self.liquidate(self.symbol)
        
        if self.time.month == 11:
            self.set_holdings(self.symbol, 1)