STRASMORE/EXPLORE 3,127 QUERIES

Where the KO/PEP spread sat twenty sessions later, by starting z score (2019-2025)

Answered against 22 years of US equities and 12 years of US options data and published with the query that produced it. This result is stored as of 2026-08-13, from Pairs Trading and Cointegration Explained.

as of ranking 6×4read in context →
Where the KO/PEP spread sat twenty sessions later, by starting z score (2019-2025) — 6 rows by 4 columns, computed from US exchange, SIP and OPRA data.
z_bucketavg_z_startavg_z_20d_laterepisode_count
z below -2-2.42-0.84138
z -2 to -1-1.4-0.59406
z -1 to 0-0.52-0.21354
z 0 to 10.520.04371
z 1 to 21.410.66331
z above 22.640.92129
Rows × columns
6 × 4
Computed
Completeness
No missing values
Source
US exchange, SIP and OPRA market data
Licence
Strasmore terms · free, no signup
Formats
JSON · CSV · the SQL below

What each column holds

Column definitions for Where the KO/PEP spread sat twenty sessions later, by starting z score (2019-2025), derived from the stored result.
ColumnTypeRangeNotes
z_bucket text 6 distinct values (z -1 to 0, z -2 to -1, z 0 to 1…)
avg_z_start number -2.42 to 2.64
avg_z_20d_later number -0.84 to 0.92
episode_count number 129 to 406 count

Computed from Strasmore's warehouse of US exchange, SIP and OPRA market data. Equity prices are delayed; options greeks and implied volatility are end-of-day. This result is stored, not recomputed on load — it is exactly the numbers that were returned on , and the query below is what returned them.

Run it yourself

This is the exact query behind the result above. Change a ticker, a date or a column and run it against the warehouse — no account, no key. The no-signup tier is smaller than the one this page was computed on; a query that reaches past it comes back saying which plan runs it.

WITH
    daily AS (
        SELECT
            date,
            anyIf(toFloat64(close), ticker = 'PEP') AS pep,
            anyIf(toFloat64(close), ticker = 'KO')  AS ko
        FROM global_markets.stocks_daily_aggs
        WHERE ticker IN ('KO', 'PEP')
          AND date BETWEEN '2018-01-01' AND '2025-12-31'
        GROUP BY date
        HAVING pep > 0 AND ko > 0
    ),
    spread AS (
        SELECT
            date,
            log(pep / ko) AS log_ratio
        FROM daily
    ),
    scored AS (
        SELECT
            date,
            (log_ratio - avg(log_ratio) OVER (
                 ORDER BY date ROWS BETWEEN 62 PRECEDING AND CURRENT ROW))
            / stddevSampStable(log_ratio) OVER (
                 ORDER BY date ROWS BETWEEN 62 PRECEDING AND CURRENT ROW) AS z
        FROM spread
    ),
    horizon AS (
        SELECT
            date,
            z,
            leadInFrame(z, 20) OVER (
                ORDER BY date ROWS BETWEEN CURRENT ROW AND 20 FOLLOWING
            ) AS z_fwd
        FROM scored
        WHERE isFinite(z)
    )
SELECT
    multiIf(z < -2, 'z below -2',
            z < -1, 'z -2 to -1',
            z <  0, 'z -1 to 0',
            z <  1, 'z 0 to 1',
            z <  2, 'z 1 to 2',
                    'z above 2')  AS z_bucket,
    round(avg(z), 2)              AS avg_z_start,
    round(avg(z_fwd), 2)          AS avg_z_20d_later,
    count()                       AS episode_count
FROM horizon
WHERE date >= '2019-01-01'
  AND date <= '2025-11-15'
  AND isFinite(z_fwd)
GROUP BY z_bucket
ORDER BY avg_z_start
⌘/Ctrl + Enter

Work with this data in your AI assistant

Opens ready to query, with this page's data. Free, no account.

More from this analysisPairs Trading and Cointegration Explained
Hedge ratio refitted each calendar year, two sector pairs ranking 7×3 → Daily-return correlation vs price-level correlation, five familiar pairs (2024-2025) ranking 5×3 → Weekly z score of the KO/PEP spread, hedge ratio fitted on 2023 only series 105×2 → Excess kurtosis by year, against the full window level ranking 21×4 → Autocorrelation of returns and absolute returns, lags 1 to 10 ranking 10×3 → Variance ratio by block length: does SPY variance scale like independent draws? ranking 7×3 → See all 3,127 queries →