STRASMORE/EXPLORE 3,256 QUERIES 22Y EQUITIES · 12Y OPTIONS

3,256 answered market questions

every one with its exact SQL, its result and the date it was computed · free, no signup

Investing at All-Time Highs: What the Data Says
Calendar days from a record close to the next one, SPYranking · 2026-10-04 · 5×4Preview: 5 ranked values, largest first. 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×4Preview: 11 ranked values, largest first. SPY close versus its 50-day and 200-day averages, February to July 2020series · 2026-10-04 · 126×4Preview: a 16-point series, ending higher. 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×2Preview: 5 ranked values, smallest first. SPY's 20 best and 20 worst days since 2016, counted by yearranking · 2026-07-16 · 11×3Preview: 11 ranked values, smallest first. The ten biggest single-day gains for SPY since 2016ranking · 2026-07-16 · 10×2Preview: 10 ranked values, largest first.
Calendar days from a record close to the next one, SPY

Calendar days from a record close to the next one, SPY

most recentas of ranking 5×4read in context →
Calendar days from a record close to the next one, SPY — 5 rows by 4 columns, computed from US exchange, SIP and OPRA data.
bucketrecord_closesshare_pctcumulative_share_pct
within 1 month40794.294.2
1 to 3 months163.797.9
3 to 6 months40.998.8
6 to 12 months20.599.3
more than 12 months30.7100
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
$