Investing at All-Time Highs: What the Data Says
Calendar days from a record close to the next one, SPYranking ·
2026-10-04 · 5×4
Forward price change after record closes vs all other sessions, SPYtable ·
2026-10-04 · 3×7
Deepest closing declines from a record close, SPYtable ·
2026-10-04 · 7×5
Record closes per year, SPY (price basis, first four years of the file excluded)table ·
2026-10-04 · 20×7
Can a Death Cross Be Bullish? The SPY Record
The window and the cross counts behind the textscalar ·
2026-10-04 · 1×115,803
Each SPY death cross and the golden cross that ended itranking ·
2026-10-04 · 11×4
SPY close versus its 50-day and 200-day averages, February to July 2020series ·
2026-10-04 · 126×4
Forward record after a SPY death cross, by horizontable ·
2026-10-04 · 4×9
Every SPY death cross in the daily data, with forward returnstable ·
2026-10-04 · 11×6
The 2020 peak, low, death cross and golden cross, dated from the same barsscalar ·
2026-10-04 · 1×16338.34
What Missing the Best Days Costs
SPY total return since 2016, after removing the best single daysranking ·
2026-07-16 · 5×2
SPY's 20 best and 20 worst days since 2016, counted by yearranking ·
2026-07-16 · 11×3
The ten biggest single-day gains for SPY since 2016ranking ·
2026-07-16 · 10×2
Calendar days from a record close to the next one, SPY
Calendar days from a record close to the next one, SPY
| bucket | record_closes | share_pct | cumulative_share_pct |
|---|---|---|---|
| within 1 month | 407 | 94.2 | 94.2 |
| 1 to 3 months | 16 | 3.7 | 97.9 |
| 3 to 6 months | 4 | 0.9 | 98.8 |
| 6 to 12 months | 2 | 0.5 | 99.3 |
| more than 12 months | 3 | 0.7 | 100 |
the exact SQL behind every number
WITH
daily AS
(
SELECT
date,
toFloat64(argMax(close, _ingest_time)) AS close
FROM global_markets.stocks_daily_aggs
WHERE ticker = 'SPY'
GROUP BY date
),
flagged AS
(
SELECT
date,
close >= max(close) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS is_record,
min(date) OVER () AS series_start,
max(date) OVER () AS series_end
FROM daily
),
highs AS
(
SELECT
date,
series_end,
leadInFrame(date, 1) OVER (ORDER BY date ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS next_high
FROM flagged
WHERE is_record = 1
AND date >= addYears(series_start, 4)
),
gaps AS
(
SELECT
if(next_high > date, dateDiff('day', date, next_high), 99999) AS gap_days
FROM highs
WHERE date <= subtractDays(series_end, 365)
),
bucketed AS
(
SELECT
multiIf(gap_days <= 31, 'within 1 month',
gap_days <= 92, '1 to 3 months',
gap_days <= 183, '3 to 6 months',
gap_days <= 365, '6 to 12 months',
'more than 12 months') AS bucket,
count() AS record_closes,
min(gap_days) AS sort_key
FROM gaps
GROUP BY bucket
)
SELECT
bucket,
record_closes,
round(100 * record_closes / sum(record_closes) OVER (), 1) AS share_pct,
round(100 * sum(record_closes) OVER (ORDER BY sort_key ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
/ sum(record_closes) OVER (), 1) AS cumulative_share_pct
FROM bucketed
ORDER BY sort_key
More from this analysisInvesting at All-Time Highs: What the Data Says
Record closes per year, SPY (price basis, first four years of the file excluded)
table 20×7
→
Deepest closing declines from a record close, SPY
table 7×5
→
Forward price change after record closes vs all other sessions, SPY
table 3×7
→
$10,000 in the S&P 500 tracker: price only vs dividends reinvested, year-end 2006 to July 2026
ranking 20×4
→
See all 3,256 queries →