S&P 500 Earning Revisions Breadth¶
© 2025 Jim Domeij & Marek Ozana
This calculates, for each GICS sector within the S&P 500, the number of companies with upward or downward EPS revisions over the past month. It can be used to track the breadth of change in analysts’ EPS estimates by sector.
Out[1]:
In [2]:
Copied!
# Get counts of comps with positive and negative earnings revisions over the past month
from polars_bloomberg import BQuery
query = """
let(
#rev = net_chg(is_eps(fpt=BT, fpo=1, ae=e, dates=range(-1M, 0d)));
#sector = classification_name(gics, 1);
#up = sum(group(if(#rev > 0, 1, 0), #sector));
#down = sum(group(if(#rev < 0, 1, 0), #sector));
)
get(#up, #down)
for(members("SPX Index"))
preferences(dropCols=["ORIG_IDS", "#sector"])
"""
with BQuery() as bq:
df = bq.bql(query).combine()
df.head()
# Get counts of comps with positive and negative earnings revisions over the past month
from polars_bloomberg import BQuery
query = """
let(
#rev = net_chg(is_eps(fpt=BT, fpo=1, ae=e, dates=range(-1M, 0d)));
#sector = classification_name(gics, 1);
#up = sum(group(if(#rev > 0, 1, 0), #sector));
#down = sum(group(if(#rev < 0, 1, 0), #sector));
)
get(#up, #down)
for(members("SPX Index"))
preferences(dropCols=["ORIG_IDS", "#sector"])
"""
with BQuery() as bq:
df = bq.bql(query).combine()
df.head()
Out[2]:
shape: (5, 3)
| ID | #up | #down |
|---|---|---|
| str | f64 | f64 |
| "Communication Services" | 18.0 | 3.0 |
| "Consumer Discretionary" | 41.0 | 8.0 |
| "Consumer Staples" | 29.0 | 7.0 |
| "Energy" | 12.0 | 10.0 |
| "Financials" | 65.0 | 9.0 |