STRASMORE/EXPLORE 3,022 QUERIES

same_direction

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-10-04, from qqq-vs-spy-for-korean-investors.

as of ranking 11×4read in context →
same_direction — 11 rows by 4 columns, computed from US exchange, SIP and OPRA data.
yearsession_countsame_direction_pctmedian_gap_pp
201625282.10.2
201725179.30.21
201825187.30.31
201925288.10.23
202025385.80.47
2021252810.34
2022251920.48
202325084.80.29
202425290.50.28
202525087.60.25
202618987.80.33
Rows × columns
11 × 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 same_direction, derived from the stored result.
ColumnTypeRangeNotes
year text 11 distinct values (2016, 2017, 2018…)
session_count number 189 to 253 count
same_direction_pct number 79.3 to 92 percent
median_gap_pp number 0.2 to 0.48

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 rets AS
(
    SELECT
        date,
        ticker,
        toFloat64(close) AS c,
        lagInFrame(toFloat64(close)) OVER
            (PARTITION BY ticker ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS prev_c
    FROM global_markets.stocks_daily_aggs
    WHERE ticker IN ('QQQ', 'SPY')
      AND date >= '2015-12-01'
      AND date <  today()
),
paired AS
(
    SELECT
        date,
        anyIf(c / prev_c - 1, ticker = 'QQQ') AS qqq_ret,
        anyIf(c / prev_c - 1, ticker = 'SPY') AS spy_ret
    FROM rets
    WHERE prev_c > 0
    GROUP BY date
    HAVING countIf(ticker = 'QQQ') > 0 AND countIf(ticker = 'SPY') > 0
)
SELECT
    toString(toYear(date))                                                             AS year,
    count()                                                                            AS session_count,
    round(100 * countIf(sign(qqq_ret) = sign(spy_ret)) / count(), 1)                   AS same_direction_pct,
    round(100 * quantileDeterministic(0.5)(abs(qqq_ret - spy_ret), toUInt32(date)), 2) AS median_gap_pp
FROM paired
WHERE toYear(date) >= 2016
GROUP BY year
ORDER BY year
⌘/Ctrl + Enter

Work with this data in your AI assistant

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