STRASMORE/EXPLORE 2,170 QUERIES

Weekly z score of the KO/PEP spread, hedge ratio fitted on 2023 only

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 series 105×2read in context →
Weekly z score of the KO/PEP spread, hedge ratio fitted on 2023 only — 105 rows by 2 columns, computed from US exchange, SIP and OPRA data.
weekz_score
2024-01-01-1.53
2024-01-08-2.4
2024-01-15-2.08
2024-01-22-0.76
2024-01-29-0.76
2024-02-05-0.82
2024-02-12-1.08
2024-02-19-1.64
2024-02-26-1.39
2024-03-04-1.6
2024-03-11-1.09
2024-03-180.68
2024-03-251.07
2024-04-010.89
2024-04-081.63
2024-04-151.43
2024-04-220.32
2024-04-290.1
2024-05-060.27
2024-05-131.17
2024-05-200.67
2024-05-27-1.75
2024-06-03-2.71
2024-06-10-2.42
2024-06-17-1.59
2024-06-24-1.92
2024-07-01-1.71
2024-07-08-1.17
2024-07-15-1.2
2024-07-22-1.24
2024-07-29-1.25
2024-08-05-1.48
2024-08-12-1.49
2024-08-19-1.29
2024-08-26-2.81
2024-09-02-1.17
2024-09-09-1.11
2024-09-16-2.1
2024-09-23-1.93
2024-09-30-1.21
2024-10-070.3
2024-10-140.02
2024-10-211.58
2024-10-281.52
2024-11-041.8
2024-11-111.46
2024-11-180.87
2024-11-250.93
2024-12-020.63
2024-12-090.29
2024-12-16-0.38
2024-12-23-0.49
2024-12-30-1.04
2025-01-06-2.39
2025-01-13-1.79
2025-01-20-1
2025-01-27-1.44
2025-02-03-2.31
2025-02-10-3.1
2025-02-17-2.14
2025-02-24-1.69
2025-03-03-1.42
2025-03-10-1.13
2025-03-17-1.1
2025-03-24-1.05
2025-03-31-0.98
2025-04-07-1.45
2025-04-14-1.81
2025-04-21-2.08
2025-04-28-1.77
2025-05-05-1.53
2025-05-12-1.62
2025-05-19-1.53
2025-05-26-1.26
2025-06-02-1.04
2025-06-09-0.69
2025-06-16-0.06
2025-06-23-0.21
2025-06-300.12
2025-07-071.41
2025-07-143.18
2025-07-212.42
2025-07-281.43
2025-08-041.4
2025-08-111.88
2025-08-181.41
2025-08-251.42
2025-09-011.33
2025-09-081.23
2025-09-151.09
2025-09-221.12
2025-09-290.83
2025-10-062.28
2025-10-131.84
2025-10-200.37
2025-10-27-0.5
2025-11-03-2.94
2025-11-10-1.93
2025-11-17-2.58
2025-11-24-1.77
2025-12-01-0.7
2025-12-080.04
2025-12-15-0.11
2025-12-22-0.68
2025-12-29-0.68
Rows × columns
105 × 2
Period covered
to
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 Weekly z score of the KO/PEP spread, hedge ratio fitted on 2023 only, derived from the stored result.
ColumnTypeRangeNotes
week date 2024-01-01 to 2025-12-29
z_score number -3.1 to 3.18

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.

the exact SQL behind every number
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 '2023-01-01' AND '2025-12-31'
        GROUP BY date
        HAVING pep > 0 AND ko > 0
    ),
    fitted AS (
        SELECT covarSamp(pep, ko) / varSamp(ko) AS beta
        FROM daily
        WHERE date < '2024-01-01'
    ),
    spread AS (
        SELECT
            daily.date                          AS date,
            daily.pep - fitted.beta * daily.ko  AS spread_usd
        FROM daily
        CROSS JOIN fitted
    ),
    scored AS (
        SELECT
            date,
            (spread_usd - avg(spread_usd) OVER (
                 ORDER BY date ROWS BETWEEN 62 PRECEDING AND CURRENT ROW))
            / stddevSampStable(spread_usd) OVER (
                 ORDER BY date ROWS BETWEEN 62 PRECEDING AND CURRENT ROW) AS z
        FROM spread
    )
SELECT
    toString(toMonday(date))   AS week,
    round(argMax(z, date), 2)  AS z_score
FROM scored
WHERE date >= '2024-01-01'
  AND isFinite(z)
GROUP BY week
ORDER BY week

Run your own version of this

The same 22 years of US equities and 12 years of options data are queryable in SQL or plain English. A free account runs 100 queries a day and takes no card.

More from this analysisPairs Trading and Cointegration Explained
Hedge ratio refitted each calendar year, two sector pairs ranking 7×3 Where the KO/PEP spread sat twenty sessions later, by starting z score (2019-2025) ranking 6×4 Daily-return correlation vs price-level correlation, five familiar pairs (2024-2025) ranking 5×3 One position, one year at a time: SPY annualized Sharpe by calendar year table 14×5 Variance ratio by block length: does SPY variance scale like independent draws? ranking 7×3 Lag-one autocorrelation: signed returns against absolute returns, 2016 to 2025 ranking 6×4 See all 2,170 queries →