S&P 500 daily % contribution

Is it possible to make script that shows how big daily % contribution single stock has in S&P 500 % daily gain. For example yesterday NVDA had about 71% % daily contribution.

Hi Pentti,

I’m not sure how that’s calculated by Bloomberg, but I found this formula on ChatGPT:

We can get the stock’s weight in the index by adding the SPY ETF to the ETF Holdings section of the Symbol List Manager.

Once added, open the SPY Symbol List as a watchlist and add the Fund Weight column (change Column Type to Percentage) and it will show that NVDA is currently 7.16% of the index by market cap. Using the formula provided above I’ve created this:

//Get SPX Daily Change %;
SPX=GETDATA(CODE=SPX:WI);
SPXCHG= CHANGE(SPX, INT_COUNT=1, INT_TYPE=Day);
//Calculate individual stock weight;
WGT=WEIGHT(SYMBOLLIST=SPY:US SPDR S&P 500 ETF)*100;
V1=CHANGE() * WGT;
//Stock as % of index move;
(V1/SPXCHG)/100

When I change the watchlist to get the data as of November 19th as per your example I get 88% for NVDA and 13% for AMZN because the weights are as of today, and therefore higher than they were on the 19th and so skewing the numbers.

Here’s the data for the 21st, with NVDA moving the same as the index (0.53%) so the % Index Move was the same as the Fund Weight. Sorting by Fund Weight shows the index was dragged down by AMZN (-2.2% price fall or -15.7% of index move) and GOOGL/GOOG (-18% & -14%).

How does that compare with Bloomberg?

image

Thank you very much! I will try this. I don’t have access to Bloomberg terminal. I just saw that screenshot in one blog post and was thinking it would be useful to see how big impact single stock could have to index move.

Yesterday I tried this script but problem was that with some stocks impact was over 100%.

// Define the daily percentage change of the individual stock
StockChange = ROC(BARS=1);

// Define the daily percentage change of the S&P 500
IndexChange = ROC(GETDATA(CODE=SPY:US), BARS=1);

// Define the weight of the stock in the index
StockWeight = WEIGHT(SYMBOLLIST=SPY:US SPDR S&P 500 ETF);

// Calculate the stock’s daily contribution to the index
Contribution = (StockChange * StockWeight) / IndexChange;

Contribution;

Hi Pentti,

The issue may be the fund weighting which is a static number: you will need to refresh the list again in the Symbol List Manager to get the most recent weights and then open the workbook.

Here’s the formula that calculates the contribution by points:

//Get SPX % Daily Change;
SPX=GETDATA(CODE=SPX:WI);
SPXCHG= CHANGE(SPX, INT_COUNT=1, INT_TYPE=Day);
//Get Daily Points Change;
SPXPTS = TROC(SPX, BARS=1);
//Calculate individual stock weight;
WGT=WEIGHT(SYMBOLLIST=SPY:US SPDR S&P 500 ETF)*100;
V1=CHANGE() * WGT;
//Points move per stock;
((V1/SPXCHG)/100)*SPXPTS

So for Nov 25th, NVDA and TSLA dragged the index down by a combined -120%, or -21.8 points, on a day the index gained 18 points:

image

I have tested your script and it seems to work fine.

1 Like

Hey Darren, how do I get the ETF symbol lists? Thanks

Hi Chad,

See here: