BLOG

Behind the numbers.

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

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 of the Nasdaq 100 Is Already in the S&P 500? Index Overlap Analysis in Python

What's the question?

A common allocation pairs an S&P 500 fund as the core with a Nasdaq 100 fund on top, and the second position is usually described as diversification, on the reasoning that two indices built under different rules produce two different baskets.

The rules are different. The S&P 500 draws from US-domiciled companies across every sector, applies an earnings test, and is picked by a committee. The Nasdaq 100 ranks the largest non-financial Nasdaq-listed companies, sets no profitability requirement, and admits foreign issuers. Different rules do not guarantee different holdings.

So the question is how much of the second fund an investor already owns through the first. Counting the shared members gives one answer; the share of Nasdaq 100 market value those members carry gives another, and the second decides portfolio outcomes, since exposure is weight rather than presence on a list.

The approach

Membership is read at 31 December, as the roster stood on that date. Backdating today’s list would answer a different question: only 32 of the 100 companies in the Nasdaq 100 at the end of 2005 were still members nineteen years later, and fewer than half of that year’s S&P 500 remained.

  1. Pull Nasdaq 100 and S&P 500 membership at each year end, keyed on entity identifiers rather than tickers. A ticker is a lease rather than a name: Q labelled Qwest Communications in the 2005 roster and now labels Qnity Electronics, spun out of DuPont in late 2025.
  2. Intersect the two sets of identifiers for each year. Share classes collapse to one company under this keying, so a company with two listed classes counts once.
  3. At the final year end, convert each Nasdaq 100 member’s closing market capitalisation into an index weight, then divide that weight between shared members and members the Nasdaq 100 holds on its own.

The panel covers the sixteen year ends between 2005 and 2024 at which the point-in-time roster resolves to exactly one hundred distinct companies, holding the denominator fixed across years.

Code

import pandas as pd
import xfinlink as xfl

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

def members(index_name, as_of):
    df = xfl.index(index_name, as_of=as_of)
    return set(int(x) for x in df["entity_id"].dropna())

rows = []
for year in range(2005, 2025):
    as_of = f"{year}-12-31"
    ndx, spx = members("ndx100", as_of), members("sp500", as_of)
    if len(ndx) == 100:
        rows.append({"year": year, "ndx": len(ndx), "both": len(ndx & spx)})
panel = pd.DataFrame(rows)

FINAL = "2024-12-31"
ndx_final = sorted(members("ndx100", FINAL))
spx_final = members("sp500", FINAL)

cap = xfl.metrics(entity_id=ndx_final, period_type="daily", fields=["market_cap"],
                  start=FINAL, end=FINAL, max_rows=100000)
cap["weight"] = 100 * cap["market_cap"] / cap["market_cap"].sum()
cap["in_sp500"] = cap["entity_id"].isin(spx_final)

print(panel.to_string(index=False))
print(cap.groupby("in_sp500")["weight"].sum())

Full script with formatting and visualisation: nasdaq-100-sp500-overlap-python.py

Output

Two panel chart: the count of Nasdaq 100 members also in the S&P 500 rises from 51 in 2005 to 84 in 2024, and the 16 members held outside the S&P 500 at the end of 2024 carry between 0.06 and 1.01 percent of Nasdaq 100 market value
Nasdaq 100 members that are also S&P 500 members, point-in-time rosters
year    NDX members  in S&P 500  outside
2005            100          51       49
2006            100          53       47
2007            100          54       46
2008            100          59       41
2009            100          64       36
2010            100          69       31
2011            100          67       33
2012            100          71       29
2014            100          73       27
2015            100          74       26
2018            100          83       17
2020            100          76       24
2021            100          75       25
2022            100          79       21
2023            100          83       17
2024            100          84       16

Market-cap weight inside the Nasdaq 100 at 2024-12-31
  84 shared members   94.64% of index weight
  16 members held only by the Nasdaq 100   5.36% of index weight
  aggregate market value  $27.02tn

Nasdaq 100 members outside the S&P 500 at 2024-12-31
ticker  company                            market cap $bn  NDX weight
ASML    A S M L HOLDING N V                         272.6       1.01%
AZN     ASTRAZENECA PLC                             203.2       0.75%
PDD     PDD HOLDINGS INC                            135.0       0.50%
ARM     A R M HOLDINGS PLC                          130.0       0.48%
APP     APPLOVIN CORP                               110.1       0.41%
MRVL    MARVELL TECHNOLOGY INC                       95.6       0.35%
MELI    MERCADOLIBRE INC                             86.2       0.32%
MSTR    Strategy Inc                                 71.2       0.26%
DASH    DOORDASH INC                                 70.4       0.26%
TEAM    ATLASSIAN CORP PLC                           63.6       0.24%
TTD     TRADE DESK INC                               58.3       0.22%
DDOG    DATADOG INC                                  48.9       0.18%
CCEP    COCA COLA EUROPACIFIC PARTNERS               35.4       0.13%
ZS      ZSCALER INC                                  27.7       0.10%
GFS     GLOBALFOUNDRIES INC                          23.7       0.09%
MDB     MONGODB INC                                  17.3       0.06%

A blended portfolio: how much sits in securities the S&P 500 fund does not hold
  90% S&P 500 fund / 10% Nasdaq 100 fund    0.54%
  80% S&P 500 fund / 20% Nasdaq 100 fund    1.07%
  70% S&P 500 fund / 30% Nasdaq 100 fund    1.61%
  60% S&P 500 fund / 40% Nasdaq 100 fund    2.15%

What this tells us

The two indices have converged. In 2005 roughly half the Nasdaq 100 sat inside the S&P 500; by the end of 2024, 84 of its 100 members did. The count climbed through the 2008 crisis and the decade after it as the large Nasdaq-listed technology companies grew into the S&P 500’s size requirement.

By weight the convergence is close to total. Shared members carry 94.64 percent of Nasdaq 100 market value, so the 16 companies the Nasdaq 100 holds alone amount to 5.36 percent of it, or $1.45tn out of $27.02tn. The gap between 84 percent by count and 94.64 percent by weight exists because the non-shared names are small; the largest of them, ASML, is 1.01 percent of the index.

Eligibility rules explain most of that residue. Six of the 16 are foreign issuers that the S&P 500’s US-domicile requirement excludes outright: ASML, AstraZeneca, PDD, Arm, Coca-Cola Europacific and GlobalFoundries. Those six are 2.96 of the 5.36 percentage points, and ASML with AstraZeneca alone account for a third of it. The rest are US companies the committee had not selected by the end of 2024, several recently listed or short of the positive earnings the S&P 500 asks for.

The setback after 2018 shows the same mechanism running in reverse. The shared count fell from 83 at the end of 2018 to 75 three years later, while the Nasdaq 100 absorbed a cohort of newly listed companies the S&P 500 could not take: Airbnb, CrowdStrike, Datadog, Lucid, Moderna, Peloton and Zoom were all in the one index and not the other. As that cohort matured, was admitted, or left, the count recovered to 84.

So what?

Treat a Nasdaq 100 sleeve as a weighting decision rather than a holdings decision: adding it to an S&P 500 core barely changes what is owned, only how much of each thing is owned. At a 30 percent allocation, 1.61 percent of the portfolio sits in securities the S&P 500 fund does not hold, and the other 28.4 percent is a second, heavier bet on companies already in the core.

That reframes the analysis an allocator should run. The question is not whether the two funds hold different names but how far the blend concentrates the top of the book: the ten largest Nasdaq 100 members are 71.3 percent of that index and are already the largest positions in the S&P 500.

If the goal is exposure the core does not provide, the 16 names are a short list, and holding them directly gives control over their size. Rebuild the rosters point in time for any historical version of this test: today’s list backdated will always make the past look more like the present.

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