SPY Turn-of-the-Month Strategy
Log in to collectAcademic paper
Wei Xu; John J. McConnell
- HSBC Holdings
- Purdue University West Lafayette
- Peking University
- ?HSBC School of Business, Peking University
- ?Purdue University
Strategy in a nutshell
This strategy entails buying SPY ETF shares, which mimic the S&P 500, one day (or in some cases, four days) before a month ends and selling them on the close of the new month's third trading day. Aimed at exploiting the anticipated shifts in market sentiment and liquidity at month's end and start, this approach seeks to leverage potential short-term gains from these predictable patterns. Such a method requires precise timing for buy and sell orders, focusing on capturing slight, regular market movements rather than long-term investments, potentially offering an edge over traditional investment strategies.
Economic rationale
The turn-of-the-month anomaly, presenting higher stock returns around month-end, remains an academic conundrum. This phenomenon is observed across both small-cap, low-price and large-cap, high-price stocks, and is not exclusive to turn-of-the-year or quarter-end periods, challenging the notion that it could stem from higher risk or systematic shifts in interest rates. Interestingly, this pattern is not unique to the U.S., occurring in 30 markets worldwide. While Ogden (1990) suggested it might be linked to the timing of income receipts, pushing equity prices up as investors seek to deploy their funds, this theory has been contested. McConnell and Xu's work echoes the sentiment that the anomaly persists without a clear explanation. Some attribute it to monthly pension fund cash flows and the rebalancing of trading models, which could amplify the effect. Nevertheless, employing this strategy requires caution as such calendar effects may diminish or shift unpredictably over time.
Backtest performance
Full Python code
from AlgoLib import *
class MonthlyMarketTiming(XXX):
def Initialize(self):
self.SetStartDate(1998, 1, 1) # Set the start date
self.SetCash(100000) # Set the initial capital
self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol # Add SPY ETF
self.readyToSell = False # Flag to trigger selling
self.tradeDaysCount = 0 # Count trade days since buying
# Schedule the buy action at the month's end
self.Schedule.On(self.DateRules.MonthEnd(self.spy), self.TimeRules.AfterMarketOpen(self.spy), self.EnterPosition)
# Schedule the sell action 3 trading days after the start of the month
self.Schedule.On(self.DateRules.MonthStart(self.spy), self.TimeRules.AfterMarketOpen(self.spy), self.InitiateSell)
def EnterPosition(self):
self.SetHoldings(self.spy, 1) # Invest all in SPY
def InitiateSell(self):
self.readyToSell = True # Set flag to start counting days to sell
def OnData(self, data):
if self.readyToSell:
self.tradeDaysCount += 1 # Increment the day count
if self.tradeDaysCount == 3: # On the third day, sell
self.Liquidate(self.spy) # Sell all SPY shares
self.readyToSell = False # Reset the flag
self.tradeDaysCount = 0 # Reset the day count