← All experiments

Experiment 005 · Market attribution

What Moved the Market?

The S&P 500 is not a mood or a headline. It is a weighted collection of companies. So when it moves, we should be able to take the move apart and see exactly which stocks pushed it up and which pulled it back.

Live · One trading day · loading…

two kinds of why

First, a small distinction

A news story tries to explain why people changed their minds. This experiment answers the narrower question underneath it: once prices moved, which companies mathematically created the market's gain?

Narrative whyWhat changed investors' expectations?

Useful, but often debatable.

Arithmetic whyWhich stocks supplied the index points?

Measurable down to a small residual.

Latest complete session

The latest market day, taken apart

Green bars pushed SPY upward and coral bars pulled it downward. A basis point is one hundredth of a percentage point. Hover or tap any bar for the stock's weight, return, and contribution.

Loading the latest result…

The company ledger

The biggest pushes and pulls

A huge stock move can barely matter if the company is small in the index. A modest move in a giant company can matter a great deal.

Added to the day

Subtracted from the day

so what happened?

Findings and Next Steps

The main answer

Loading the largest contributors

The newest holdings and prices are being assembled.

The wider market

Loading market breadth

The number of advancing and declining securities will appear here.

The counterweight

Loading the largest counterweight

The largest move against the market will appear here.

Where I would take this next

  • Repeat the ledger on a sharp down day and compare how concentrated the damage was.
  • Group contributions by sector to see whether the day was broad or driven by one part of the economy.
  • Build a daily archive using point-in-time holdings so index membership changes are handled exactly.

from a headline to a ledger

How I counted the move

The S&P 500 gives larger publicly tradable companies more weight. This page uses the newest complete State Street SPY holdings file and the closing price change of every covered security from the prior trading session.

  1. 01

    Start with the same basket

    The file can contain more than 500 securities because a few S&P 500 companies have two listed share classes. The validation step requires the measured securities to cover at least 99.5% of SPY's closing weight.

  2. 02

    Reconstruct opening weights

    The published weights are from the end of the day. I reverse each stock's return to estimate what its weight was before trading began.

  3. 03

    Multiply weight by return

    A stock at 6% of the basket that rises 2% adds about 0.12 percentage points. That is 12 basis points of market movement.

  4. 04

    Add every contribution

    Adding all covered company contributions reconstructs the basket return. The page reports the small residual versus SPY rather than forcing the two numbers to agree.

the math behind “up”

The Math Zone

Let i be a security, t the chosen day, P its closing price, and w its weight at the start of the day.

01 · company return

How far did it move?

ri,t=Pi,tPi,t−1−1

This is the ordinary close-to-close stock return.

02 · opening weight

How much did it count?

wi,t−1=wi,t1+ri,t∑jNwj,t1+rj,t

Because State Street reports closing weights, we divide out the day's return and renormalize to recover the opening basket.

03 · contribution

What did it add?

ci,t=wi,t−1ri,t

Contribution combines size and movement. Multiply by 10,000 to express it in basis points.

04 · the whole day

Put the market back together

Rt=∑i=1Nci,t

Add the positive and negative contributions to reconstruct the market's move for the day.

What this does and does not explain

This is an arithmetic attribution, not proof that any headline caused a stock to move. It uses SPY as a transparent, investable approximation of the S&P 500 rather than proprietary point-in-time index files. Closing prices also hide everything that happened within the trading day.

The weighting and divisor framework follows S&P Dow Jones Indices' Index Mathematics Methodology ↗. Constituent names, shares, and weights come from State Street's latest complete SPY holdings ↗. Close-to-close prices come from Yahoo Finance. This experiment is for education and is not investment advice.