BLOG

Behind the numbers.

Code examples, market analysis, and data quality deep-dives.

How Far Apart Do S&P 500 Stocks Move? Cross-Sectional Return Dispersion in Python
Fama-French Factor Data: Download or Build Your Own?
How Much Does the Rebalance Date Change a Backtest? 21 Rebalance Days in Python
Does Trading Volume Predict Tomorrow's Volatility? Out-of-Sample Test in Python
Do Company Insiders Predict Their Own Stock's Returns? Form 4 Cross-Section in Python
How Many Independent Bets Are There in the S&P 500? Principal Component Analysis in Python
Can a Company's Revenue Be Forecast From Its Own History? Out-of-Sample Test in Python
What Is EBITDA and Why Do Sources Disagree?
Does the Turn-of-the-Month Effect Still Work? Calendar Anomaly Test in Python
Is the S&P 500 Getting More Capital Intensive? Capex Analysis in Python
Do High-Accrual Companies Underperform? Accruals Screening in Python
What Does a Financial Data API Cost?
Do Price Gaps Get Filled? Gap-Fill Rates Against a Random Walk in Python
What Expected Returns Does the S&P 500 Imply? Reverse Optimization in Python
Which Sectors Are Really Cyclical? Revenue Betas vs Stock Betas in Python
How to Build a Stock Dataset for Machine Learning
Comparing Companies With Different Fiscal Year Ends
How Much Has Corporate Debt Actually Repriced? Effective Interest Rates in Python
Does Deferred Revenue Predict Next Quarter's Sales? Leading Indicator Test in Python
How Much Debt Is Hidden in Operating Leases? Lease-Adjusted Leverage in Python
How Much Do Profits Move When Sales Move? Operating Leverage Regression in Python
How Concentrated Is the S&P 500? Index Weight Analysis in Python
How Long Is Cash Tied Up in a Business? Cash Conversion Cycle Analysis in Python
Broker API vs Data API for Historical Stock Data
Where to Get Free Cash Flow Data for Stocks in Python
Are Stock Returns Skewed? Return Skewness in Python
Do High-Margin Companies Trade at Higher Multiples? EV/Sales in Python
How Much Profit Becomes Cash? Free Cash Flow Conversion in Python
Which Sectors Lead Out of a Market Bottom? Sector Recovery Analysis in Python
Are Buybacks Funded by Cash Flow or by Debt? S&P 500 Payout Analysis in Python
What to Look for in Fundamentals Data
Does Cash on the Balance Sheet Cushion a Crash? Quintile Sorts in Python
Do Corporate Insiders Time the Market? S&P 500 Insider Buying Breadth in Python
Does Unstable Volatility Warn of Deeper Drawdowns? Vol-of-Vol Sorts in Python
Does Fast Asset Growth Predict Weak Stock Returns? Decile Sorts in Python
How to Replace yfinance in a Python Script
Does the Nasdaq-100 Index Effect Still Exist? Event Study in Python
Does the Piotroski F-Score Still Work? Quality Screening in Python
How Many S&P 500 Stocks Beat the Index? Return Breadth Analysis in Python
Why Beta Differs Between Data Sources
Where to Get Historical Dividend Data for Stocks
Does a High Dividend Yield Predict a Dividend Cut? Yield-Trap Screening in Python
Do Old Ticker Symbols Still Point to the Same Company? S&P 500 Ticker Recycling in Python
What Growth Is Priced Into the S&P 500? Reverse DCF in Python
Ticker vs CIK vs FIGI: Which Company ID to Use
Does Illiquidity Still Pay? Amihud Measure in the S&P 500 in Python
Where to Get R&D Spending Data for Public Companies
Does R&D Spending Predict Revenue Growth? Cross-Sectional Test in Python
What Actually Drives Return on Equity? DuPont Decomposition in Python
What Data Do You Need to Measure Portfolio Risk?
Does a 60/40 Portfolio Actually Cut Drawdowns? Stocks and Bonds in Python
Do Steady Margins Mean Calmer Stocks? Cross-Sectional Analysis in Python
Do Sectors Diversify When It Matters? Conditional Correlation in Python
How to Get Historical Market Cap Data in Python
How Much of the S&P 500 Survives 20 Years? Index Turnover Analysis in Python
Does Joining the S&P 500 Bring New Institutional Owners? 13F Event Study in Python
Is Volatility Seasonal? Calendar Month Analysis of Realized Volatility in Python
Does Fast Revenue Growth Force Companies to Borrow? Cash Funding Analysis in Python
How Far Back Does SEC EDGAR Data Go?
Are One-Time Charges Really One-Time? Charge Frequency Analysis in Python
Does Buying the Dip Work? Short-Term Reversal by Volatility Regime in Python
Alpha Vantage vs Massive vs xfinlink for Fundamentals
How Long Does a Stock Take to Recover From a 50% Fall? Drawdown Analysis in Python
Do Companies That Shrink Their Share Count Outperform? Net Buyback Yield in Python
How Much Does the Dow's Price Weighting Distort It? Index Weighting Analysis in Python
How to Get SEC Form 4 Insider Trading Data in Python
Can Anything Predict Next Month's Stock Returns? Out-of-Sample R-Squared Testing in Python
How Much of a Stock's Return Comes From Its Sector? Variance Decomposition in Python
Altman Z-Score: Where To Get It in Python
Do Value Screens Agree on Which Stocks Are Cheap? Multiple Overlap Analysis in Python
Annual vs Quarterly Financial Data: Which to Use
Do High Returns on Capital Persist? ROIC Fade Analysis in Python
Does Past Beta Predict Future Beta? Beta Stability Testing in Python
Do Defensive Sectors Actually Defend? Up and Down Capture in Python
How to Choose a Financial Data API
Do Small Caps Actually Beat Large Caps? Size Premium Test in Python
What If You Miss the Market's Best Days? Extreme-Day Analysis in Python
Does Rebalancing Add Return? Fixed-Weight vs Drift Portfolios in Python
Which S&P 500 Companies Are Closest to Default? Merton Distance-to-Default in Python
What Happens to Stocks Removed From the S&P 500? Replacement Pair Analysis in Python
Does the Golden Cross Work? 50/200 Moving Average Crossover Backtest in Python
Financial Data for Academic Finance Research
Does Skipping the Most Recent Month Improve Momentum? S&P 500 Decile Sorts in Python
Does Cointegration Survive Out of Sample? Pairs Trading Validation in Python
Which Dividends Are Not Covered by Cash? Free-Cash-Flow Coverage Screening in Python
GICS vs SIC vs NAICS: Which Industry Classification to Use
How Many Stocks Does It Take to Diversify? Random Portfolio Simulation in Python
How Many Days of Data Does a Volatility Estimate Need? Range-Based Estimators in Python
How Much of S&P 500 Cash Flow Is Stock Compensation? Cross-Sectional Analysis in Python
What Is a 13F Filing? Institutional Holdings Explained
Does Revenue Growth Explain Profit Growth? Cross-Sectional Decomposition in Python
How Much of the Nasdaq 100 Is Already in the S&P 500? Index Overlap Analysis in Python
How Often Does a 99% Value-at-Risk Limit Actually Break? VaR Backtesting in Python
Real-Time vs End-of-Day Market Data: Which Do You Need?
How Concentrated Are S&P 500 Earnings? Point-in-Time Index Analysis in Python
Does Volatility Scale With the Square Root of Time? Variance Ratio Test in Python
Does Goodwill Distort the Price-to-Book Screen? Goodwill-Adjusted Valuation in Python
How Are Shares Outstanding Reported (and Why They Disagree)
Do Low-Volatility Stocks Deliver Better Risk-Adjusted Returns? S&P 500 Quintile Sorts in Python
Does Trend Following Beat Buy and Hold? Time-Series Momentum in Python
Has the Stock-Bond Correlation Flipped? 60/40 Portfolio Risk in Python
What API to Use for a Stock Screener
Which Assets Hedge Inflation Shocks? Macro Factor Betas in Python
Does Covariance Shrinkage Beat the Sample Covariance? Minimum-Variance Portfolios in Python
Do Faster Inventory Turns Mean Thinner Margins? Gross Margin Return on Inventory in Python
SEC EDGAR API vs Fundamentals API: Which to Use
Does Fast Earnings Growth Persist? Rank Correlation Analysis in Python
Split Adjustment Explained: Adjusted Close vs Close
Which Trading Day of the Month Pays Best? Turn-of-the-Month Analysis in Python
Can You Use Yahoo Finance Data Commercially?
How Many Independent Bets Does a Nine-Sector Portfolio Give You? Eigenvalue Analysis in Python
Which Volatility Forecast Wins One Month Ahead? HAR vs EWMA in Python
How Concentrated Are Institutional Equity Portfolios? Form 13F Concentration Analysis in Python
Do Stocks Earn Their Returns Overnight or Intraday? Return Decomposition in Python
When Do Corporate Insiders Actually Trade? Form 4 Timing Analysis in Python
Data Requirements for Backtesting a Trading Strategy
What Is Survivorship Bias in Backtesting?
Do High Dividend Yields Come From Bigger Payouts or Falling Prices? Yield Decomposition in Python
Do Stocks Fall Harder Than They Rise? Downside Beta vs Upside Beta in Python
Does Volatility Targeting Improve Sharpe Ratios? Seven-Asset Backtest in Python
Free Stock Market Data APIs: What You Actually Get
How to Give an LLM Financial Data With an MCP Server
Does Post-Earnings Announcement Drift Survive Real Filing Dates? PEAD Event Study in Python
Do Insider Buying Clusters Predict Returns? Signal Testing in Python
Does the S&P 500 Index Effect Still Exist? Event Study in Python
Are Companies Leaving the S&P 500 Faster Than They Used To? Index Survival Analysis in Python
Does Gross Profitability Predict Stock Returns? Quintile Factor Test in Python
What Growth Rate Is the Market Pricing In? Reverse DCF in Python
Does a Strong Balance Sheet Cushion Drawdowns? Leverage and Downside Risk in Python
Does Ticker Recycling Corrupt a Mean-Reversion Backtest? Entity-Resolved Z-Scores in Python
How Much of a Growth Screen's Backtested Edge Is Survivorship Bias? Point-in-Time Index Testing in Python
Why Do Leveraged ETFs Decay? Measuring Volatility Drag in Python
Are Consumer Staples Margins Shrinking Under Inflation? Gross Margin Trend Analysis in Python
Do Weak Jobs Reports Predict Market Drawdowns? NFP Surprise Event Study in Python
Is the Rotation From Tech to Industrials Backed by Earnings? Relative EPS Growth Analysis in Python
Is the Semiconductor Rally Broadening Beyond NVIDIA? Return Dispersion Analysis in Python
Which Stocks Benefit Most When Oil Prices Fall? Oil Beta Screening in Python
Do Bond Returns Predict Stock Returns? Granger Causality Test in Python
Which Stocks Actually Drive Portfolio Returns? Shapley Value Attribution in Python
Does "Sell in May" Still Work? Calendar Anomaly Backtest in Python
How to Build Complete Price History Through Ticker Changes? Entity Resolution in Python
Are KO and PEP Cointegrated? Pairs Trading Signal Construction in Python
Which Commodities Have the Strongest Momentum? Rotation Backtest in Python
Which Commodity ETFs Have the Worst Tail Risk? Expected Shortfall in Python
Are Gold Miners Leveraged Gold Bets? Rolling Beta Analysis in Python
Does the Base-Metals-to-Gold Ratio Lead Cyclical Stocks? Signal Test in Python
Can Risk Parity Tame Commodity Volatility? Portfolio Optimization in Python
Are Power Stocks Becoming an AI Infrastructure Trade? Momentum Screening in Python
Which AI Chip Stocks Have Margin Momentum? Profitability Trend Analysis in Python
Which AI Stocks Are Cheapest Relative to Growth? Growth-Adjusted Valuation in Python
Does AI Stock Leadership Persist? Momentum Backtest in Python
Which AI Stocks Have the Cleanest Balance Sheets? Net Cash Screening in Python
Can Risk Parity Reduce Mega-Cap Drawdowns? Portfolio Optimization in Python
Which Growth Stocks Are Self-Funding? Cash-Flow Quality Screening in Python
Which Sectors Struggle When the Dollar Rallies? Sector Rotation Analysis in Python
Do Cheap Stocks Hold Up When Bonds Sell Off? Valuation Rotation in Python
Does the Nasdaq 100 Have Better Growth Quality Than the Dow? Index Constituent Analysis in Python
Do Healthcare Cash-Flow Margins Predict Returns? Signal Evaluation in Python
Which Dividend Stocks Survive a Cash-Flow Stress Test? Dividend Screening in Python
Does Heavy Insider Selling Predict Weak Returns? Insider Flow Test in Python
Can Quality Screens Reduce Small-Cap Balance-Sheet Risk? Russell 2000 Test in Python
Which Retailers Have Positive Operating Leverage? Margin Screening in Python
Is MSTR a Leveraged Bitcoin Proxy? Rolling Beta Analysis in Python
Is Micron's Memory Cycle Recovering? Inventory and Margin Forecasting in Python
Which Sectors Work When Bonds Rally? Rate-Sensitive Rotation in Python
Do One-Month Price Extremes Reverse? Signal Evaluation in Python
Do Low-Volatility S&P 500 Stocks Reduce Drawdowns? Factor Test in Python
Is AI Capex Paying Back Fast Enough? Revenue Hurdle Forecasting in Python
Could Shorter AI Asset Lives Hit Earnings? Depreciation Stress Test in Python
How Much AI Capex Risk Can a Portfolio Remove? Constrained Optimization in Python
Is the AI Capex Trade Crowded? Rolling Volatility and Sector Rotation in Python
Did the AI Boom Come From Existing S&P 500 Members? Point-in-Time Momentum Test in Python
Is AI Revenue Circular? Customer-Vendor Capex Loop Analysis in Python
Is the AI Trade Connected to Private Credit? Rolling Correlation Network in Python
Is Apollo More Balance-Sheet Sensitive Than Peers? Leverage Screen in Python
Are AI Earnings Supported by Cash Flow? Accrual and Capex Screen in Python
Can Defensive Stocks Hedge AI Drawdowns? Basket Regime Test in Python
How Fast Does the Market Price In Fed Decisions? FOMC Event Study in Python
How Much Are Options Sellers Overpaid? The Variance Risk Premium in Python
Which Companies Have the Worst Earnings Quality? Sloan Accrual Screen with Geographic Revenue Data in Python
Does the Oil-to-Gold Ratio Signal Recessions? XLE/GLD Backtest in Python
Is AI Spending Crowding Out Free Cash Flow? Capex Sustainability Across the Mag 7 in Python
Does a Long Energy / Short Bonds Portfolio Capture Inflation Surprises? Factor Construction in Python
Can a Hidden Markov Model Detect Oil Market Regimes? HMM Analysis in Python
Do Grain Prices Predict Food Inflation? Granger Causality Test in Python
Does the Corporate Credit Spread Predict Stock Market Crashes? BAA-AAA Spread Analysis in Python
Do Oil Stocks Hedge Inflation? Rolling Beta Analysis in Python
Which Stocks Are Most Rate-Sensitive? Equity Duration via Bond Beta in Python
Which Companies Have the Highest Accrual Ratios? Earnings Quality Screening in Python
Is Alpha Persistent or Decaying? Rolling Sharpe Ratio Analysis in Python
Are Markets Trending or Mean-Reverting? Hurst Exponent Analysis in Python
Is Consumer Discretionary vs Staples a Leading Indicator? XLY/XLP Ratio Analysis in Python
Does Heavy Capex Predict Future Stock Returns? Capital Expenditure Analysis in Python
How to Estimate Cost of Equity Using CAPM in Python
Is Volatility Predictable? Testing for Volatility Clustering in Python
Which Industrials Are Overleveraged? Net Debt to EBITDA Screening in Python
GM Before and After Bankruptcy: Why Entity Resolution Matters for Financial Data
What Is Adjusted Beta? Merrill Lynch Beta Shrinkage in Python
How Good Is a Stock Pick? Information Ratio and Tracking Error in Python
Do Stock Returns Follow a Normal Distribution? Testing for Fat Tails in Python
Which Large Caps Have the Highest Free Cash Flow Yield? FCF Screening in Python
Which Sectors Won Over 5 Years? Sector Rotation Analysis in Python
How to Forecast Stock Volatility with GARCH Models in Python
Are Stock Prices Mean-Reverting? Augmented Dickey-Fuller Test in Python
How to Calculate CAPM Alpha and Beta with Regression in Python
How to Compare Sector Sharpe Ratios and Sortino Ratios in Python
DELL: Why Stitching Historical Price Data Together Is Wrong
How to Analyze Drawdown and Recovery for Bank Stocks in Python
How to Screen SaaS Stocks by Revenue Growth and Cash Flow in Python
How to Screen REITs by Dividend Yield and Valuation in Python
How Correlated Are the Magnificent 7? Intra-Group Correlation in Python
AAPL vs XOM: Do Individual Stocks Have Seasonal Patterns?
How to Rank Large-Cap Stocks by Momentum in Python
How to Build a Multi-Endpoint Financial Dashboard in Python
How to Compare Volatility Across Energy Stocks in Python
How to Screen Healthcare Stocks by Valuation in Python
How to Build a Sector Correlation Matrix for Portfolio Diversification in Python
How to Find Oversold and Overbought Stocks Using Z-Scores in Python
How to Measure Earnings Quality: Cash Flow vs Net Income in Python
How to Build a Multi-Factor Stock Screen in Python (Value + Momentum + Quality)
How to Build a Simple DCF Model for Any Stock in Python
How to Screen Tech Stocks by Revenue Growth in Python
How to Screen Stocks by Balance Sheet Health in Python
Is "Sell in May" Real? SPY Monthly Seasonality Over 10 Years
How to Compare Sector Performance YTD Using Python
How to Screen Dividend Stocks by Yield and Quality in Python
How to Calculate Max Drawdown and Recovery Time for Any Stock in Python
How to Compare Profitability Across Mega-Cap Tech Stocks in Python
Why Ticker Symbols Are Unreliable: The Recycling Problem Every Quant Should Know
How to Calculate and Compare Stock Volatility in Python
How to Screen Blue-Chip Stocks by P/E Ratio in Python
How to Track Companies Through Ticker Changes, Bankruptcies, and Renames in Python
S&P 500 Turnover: How Much the Index Has Changed Since 2010
How to Calculate Stock Beta and Correlation in Python
← All articles

How Much Does the Rebalance Date Change a Backtest? 21 Rebalance Days in Python

What’s the question?

Almost every published equity backtest re-forms its portfolio at the end of the month. The convention comes from data availability rather than theory: monthly return files were what researchers had, so month end became the rebalance date and stopped being questioned.

Nothing about a signal points to the 31st. A momentum ranking computed on the 30th and one computed on the 7th sort nearly the same companies on nearly the same information, so a strategy with a real edge should be close to indifferent between them. Where it is not, part of the reported performance belongs to the calendar.

Run the same strategy 21 times changing only the rebalance day: the width of the resulting distribution is the luck. If that width matches the edge being claimed, a single-date result is one draw rather than an answer.

The approach

The test signal is 12-1 cross-sectional momentum: rank every index member on its total return over the twelve months ending one month ago, buy the top decile, sell the bottom decile, and hold to the next rebalance. Once the window is fixed, nothing is left to tune.

Offsets are counted in trading days back from each calendar month end. Offset 0 is the last trading day of the month, offset 20 around the 3rd. Counting this way keeps the number of rebalances and the length of every holding period identical across the 21 runs, so only the phase within the month changes. In a 19-day month offset 20 reaches into the previous month, which happens 44 times in 127.

  1. Pull S&P 500 membership at each month end from November 2014 to July 2026, carrying every company by entity identifier rather than by ticker, so a recycled symbol cannot splice one company’s prices onto another’s. The roster used is the most recent one strictly before the rebalance date, which removes survivorship bias.
  2. Pull daily closes and daily total returns for the 730 companies appearing in any roster and compound every period aggregate from those dailies. Where period boundaries fall is the entire question here.
  3. Screen the panel: duplicate rows and non-positive prices go, and a name whose daily total return ever doubles or halves is set aside rather than winsorised. Names without a usable daily series drop from the sample.
  4. Run the identical backtest 21 times over that panel in memory, changing only the offset. A name is ranked only if it holds an unbroken daily series across its formation window and its holding month.

Sharpe is mean return over volatility, no risk-free deduction.

Code

import numpy as np
import pandas as pd
import xfinlink as xfl
from concurrent.futures import ThreadPoolExecutor

xfl.set_api_key("YOUR_API_KEY")  # free at https://xfinlink.com/signup

SNAPSHOTS = pd.date_range("2014-11-30", "2026-07-31", freq="ME").strftime("%Y-%m-%d").tolist()
ANCHORS = [s for s in SNAPSHOTS if s >= "2016-01-01"]
FORM, SKIP, OFFSETS = 252, 21, 21

with ThreadPoolExecutor(8) as pool:
    rosters = dict(zip(SNAPSHOTS, pool.map(
        lambda d: sorted(int(e) for e in xfl.index("sp500", as_of=d)["entity_id"].dropna()),
        SNAPSHOTS)))
universe = sorted({e for ids in rosters.values() for e in ids})

with ThreadPoolExecutor(8) as pool:
    px = pd.concat([d for d in pool.map(
        lambda e: xfl.prices(entity_id=e, start="2014-11-01", end="2026-07-31",
                             fields=["close", "return_daily"], max_rows=200000),
        universe) if len(d)], ignore_index=True)

px = px.drop_duplicates(["entity_id", "date"])
px = px[px["close"] > 0]
R = px.pivot(index="date", columns="entity_id", values="return_daily").sort_index()
R = R[[c for c in R.columns if not ((R[c] > 1.0).any() or (R[c] < -0.5).any())]]

cal = R.index
logret = np.log1p(R.fillna(0.0)).cumsum().values   # cumulative log total return
live = R.notna().cumsum().values                   # cumulative count of traded days
pos = {e: i for i, e in enumerate(R.columns)}
snaps = pd.to_datetime(SNAPSHOTS)
month_end = pd.Series(np.arange(len(cal))).groupby(np.asarray(cal.year * 100 + cal.month)).max()


def backtest(offset):
    """Re-form the deciles 'offset' trading days before each calendar month end."""
    days = [int(month_end[int(a[:4]) * 100 + int(a[5:7])]) - offset for a in ANCHORS]
    spread = []
    for t, nxt in zip(days, days[1:]):
        members = rosters[SNAPSHOTS[snaps.searchsorted(cal[t], "left") - 1]]
        ids = np.array([pos[e] for e in members if e in pos])
        usable = ((live[t - SKIP, ids] - live[t - FORM, ids] == FORM - SKIP)
                  & (live[nxt, ids] - live[t, ids] == nxt - t))
        ids = ids[usable]
        signal = logret[t - SKIP, ids] - logret[t - FORM, ids]   # months t-12 to t-1
        held = np.expm1(logret[nxt, ids] - logret[t, ids])       # the month held
        rank = np.argsort(np.argsort(signal, kind="stable"), kind="stable")
        decile = rank * 10 // len(ids)
        spread.append(held[decile == 9].mean() - held[decile == 0].mean())
    return np.array(spread)


runs = {k: backtest(k) for k in range(OFFSETS)}
for k, s in runs.items():
    print(f"offset {k:2d}  {np.prod(1 + s) ** (12 / len(s)) - 1:7.2%} a year  "
          f"Sharpe {s.mean() / s.std(ddof=1) * np.sqrt(12):6.2f}")

Full script with formatting and visualisation: rebalance-date-luck-backtest-python.py

Output

Annualised return of a 12-1 momentum winners-minus-losers spread at 21 different rebalance days of the month, and the growth of one dollar in each of the 21 runs, S&P 500 2016 to 2026
Rebalance-date sensitivity of a 12-1 momentum decile sort, point-in-time S&P 500
Panel: 141 month-end rosters covering 730 companies; 723 carry a daily series for the window and 23 are set aside
       by the return screen, leaving 700 names and 1,801,128 daily observations
Runs:  21 rebalance offsets, each with 127 rebalance dates and 126 holding periods, 2016-01 to 2026-07
Offset k re-forms the deciles k trading days before the calendar month end (k=0 is month end)

Offset  Typical  Names   Winners   Losers   Long-short   Ann vol  Sharpe      t
 (days)   day    ranked   a year   a year       a year
    0       30     483   14.89%   12.63%       -2.72%    22.64%   -0.01  -0.02
    1       29     483   14.82%   13.93%       -4.30%    24.28%   -0.05  -0.17
    2       27     483   13.21%   14.17%       -6.53%    25.61%   -0.12  -0.39
    3       26     483   13.98%   14.30%       -5.80%    26.08%   -0.08  -0.27
    4       24     483   15.07%   14.12%       -3.65%    22.10%   -0.05  -0.17
    5       23     483   14.83%   13.44%       -2.85%    20.52%   -0.04  -0.12
    6       21     483   14.83%   13.89%       -3.42%    21.10%   -0.06  -0.19
    7       20     483   13.92%   14.05%       -4.13%    20.86%   -0.10  -0.31
    8       19     483   14.22%   15.69%       -5.37%    20.93%   -0.16  -0.51
    9       17     483   13.60%   16.01%       -7.19%    23.00%   -0.20  -0.66
   10       16     483   14.05%   15.98%       -7.01%    24.12%   -0.17  -0.56
   11       14     483   14.53%   15.80%       -6.26%    23.25%   -0.15  -0.50
   12       13     483   14.39%   14.84%       -4.80%    22.39%   -0.10  -0.34
   13       11     484   14.71%   14.97%       -4.23%    21.17%   -0.10  -0.31
   14       10     484   14.77%   15.00%       -4.35%    21.74%   -0.09  -0.30
   15        9     484   14.56%   14.24%       -6.90%    28.46%   -0.08  -0.27
   16        7     484   13.94%   14.05%       -8.47%    30.42%   -0.11  -0.35
   17        6     484   13.42%   13.58%       -7.49%    29.82%   -0.09  -0.30
   18        4     484   13.94%   14.11%       -6.23%    26.30%   -0.10  -0.33
   19        3     484   14.44%   13.02%       -3.61%    23.21%   -0.04  -0.12
   20        3     483   14.33%   13.44%       -4.14%    22.67%   -0.07  -0.22

Spread of outcomes across the 21 rebalance offsets
  Long-short a year        best   -2.72%  (offset 0, around the 30th)
                           worst  -8.47%  (offset 16, around the 7th)
                           gap     5.74% a year, standard deviation 1.66%
  Winners leg a year        13.21% to 15.07%, gap 1.85%
  Losers leg a year         12.63% to 16.01%, gap 3.38%
  Sharpe                     -0.20 to -0.01
  t-statistic                -0.66 to -0.02
  One dollar becomes          0.75 at the best offset against 0.39 at the worst
  The 2021-2026 half alone   0.12% to 6.01%, gap 5.90%

  Typical gap between the best and worst offset in one month  11.41%
  Sampling error of the month-end run alone, annualised   6.99%
  Mean pairwise correlation of the 21 monthly spreads     0.580
  Winner decile shared, month-end sort against mid-month  79.6%

What this tells us

The 21 runs rank almost the same companies and land 5.74 percentage points a year apart. Month end returns −2.72% a year and the 7th returns −8.47%, while the winner deciles picked at month end and in the middle of the month share 79.6% of their names. This is one portfolio, priced on different days.

Both legs move. The winners leg ranges from 13.21% to 15.07% a year and the losers leg from 12.63% to 16.01%; one dollar in the spread ends at 0.75 at the luckiest offset against 0.39 at the unluckiest. Inside a single holding month the best and worst offsets typically differ by 11.41 points.

The standard error of the month-end run’s own annualised mean is 6.99 points, so the spread across rebalance days is four fifths of one standard error. The recent half of the sample shows the cost: over holding periods ending 2021 onward every offset turns positive, yet the range runs from 0.12% to 6.01% a year. Same signal, same universe, same code, same 126 months.

The shape across offsets is not flat, month end and the turn of the month being strongest, but with 21 runs sharing 126 months and correlating at 0.580 one decade cannot separate a turn-of-the-month tilt from noise.

So what?

Sweep the offset before believing a monthly backtest. One price panel and 21 in-memory passes turn a single number into a distribution: the range, and where the conventional month-end figure sits inside it. A result that holds at one offset and vanishes at the other twenty is not a result.

Check the direction of the flattery. Month end produced the best of the 21 outcomes here, and month end is what the convention picks; a strategy strongest on exactly the conventional date deserves more scepticism than its Sharpe invites.

The live remedy is mechanical: split the rebalance into tranches, a fifth of the book on each of five consecutive days, and the portfolio earns close to the average of this distribution rather than one draw from it. At 5.74 points a year against a claimed edge smaller than itself, the calendar is otherwise making the larger decision.

Built with xfinlink — free financial data API for Python. pip install -U xfinlink

Built with xfinlink — free financial data API for Python. pip install -U xfinlink
← All articles