STRASMORE/EXPLORE 2,173 QUERIES 22Y EQUITIES · 12Y OPTIONS

2,173 answered market questions

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

When Equal Weight Beats Optimization
A rolling one year mean return, the number an optimizer would be fedseries · 2026-08-16 · 96×3Preview: a 16-point series, ending higher. Ten years of yearly estimates: the mean moves far more than the volatilityranking · 2026-08-16 · 6×3Preview: 6 ranked values, largest first. How far the mean and volatility estimates scatter by sample lengthranking · 2026-08-16 · 5×4Preview: 5 ranked values, largest first.
A rolling one year mean return, the number an optimizer would be fed

A rolling one year mean return, the number an optimizer would be fed

most recentas of series 96×3read in context →
A rolling one year mean return, the number an optimizer would be fed — 96 rows by 3 columns, computed from US exchange, SIP and OPRA data.
monthspy_trailing_mean_pctko_trailing_mean_pct
2017-01-0117.7-0.4
2017-02-0120.7-3.3
2017-03-0116.1-5.9
2017-04-0113.2-5.4
2017-05-0115.2-1
2017-06-0115.91.6
2017-07-0113.60.1
2017-08-0112.35
2017-09-0114.77.7
2017-10-0117.89.6
2017-11-0118.210.8
2017-12-0117.210.8
2018-01-0120.612.6
2018-02-0115.37.5
2018-03-0113.73.8
2018-04-0112.42.8
2018-05-0112.8-3.5
2018-06-0113.1-3.3
2018-07-0113.81.3
2018-08-0115.91.6
2018-09-0116.11
2018-10-019.41.2
2018-11-015.97.9
2018-12-01-2.46.4
2019-01-01-52.6
2019-02-013.16.9
2019-03-014.86.5
2019-04-0110.28.9
2019-05-016.715.7
2019-06-01617.5
2019-07-018.416.9
2019-08-012.916.9
2019-09-014.119.1
2019-10-017.817.5
2019-11-0114.48.8
2019-12-0121.713.2
2020-01-0123.619
2020-02-011823.1
2020-03-01-3.45.6
2020-04-01-0.52.6
2020-05-017.2-2.4
2020-06-0112.4-4.1
2020-07-0112.2-6.6
2020-08-0121.1-6.1
2020-09-0117.4-3.3
2020-10-0119.2-2.4
2020-11-0118.94.3
2020-12-0120.63.9
2021-01-0120.1-6.6
2021-02-0122.2-10.5
2021-03-0142.612.4
2021-04-0142.417.3
2021-05-0137.121.1
2021-06-0132.318.8
2021-07-013220
2021-08-0128.518.3
2021-09-0128.811
2021-10-0127.310.1
2021-11-0128.58.4
2021-12-0124.37.6
2022-01-0119.520.8
2022-02-011421.7
2022-03-0112.517.6
2022-04-016.819.6
2022-05-01-1.617
2022-06-01-6.613.3
2022-07-01-8.913.7
2022-08-01-4.713.8
2022-09-01-12.110.3
2022-10-01-15.46.1
2022-11-01-14.710.8
2022-12-01-14.813.4
2023-01-01-11.73.6
2023-02-01-5.6-0.4
2023-03-01-7.21.4
2023-04-01-4.20.2
2023-05-014.7-0.6
2023-06-0112.5-0.5
2023-07-0116.5-1.2
2023-08-018.5-4
2023-09-0114.4-2.9
2023-10-0115.4-2.6
2023-11-0114.3-4.5
2023-12-0118.6-7
2024-01-0120.6-2.1
2024-02-0121.41.1
2024-03-0127.51
2024-04-0122.4-4.3
2024-05-01240.8
2024-06-0122.84.9
2024-07-0121.46.4
2024-08-0121.414.2
2024-09-0124.922
2024-10-0131.324.3
2024-11-0129.311.1
2024-12-0125.87.5
the exact SQL behind every number
WITH prices AS
(
    SELECT
        ticker,
        date,
        toFloat64(max(close)) AS c
    FROM global_markets.stocks_daily_aggs
    WHERE ticker IN ('SPY', 'KO')
      AND date >= '2015-10-01'
      AND date <  '2025-01-01'
    GROUP BY ticker, date
),
rets AS
(
    SELECT
        ticker,
        date,
        c / lagInFrame(c, 1) OVER (PARTITION BY ticker ORDER BY date ASC ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) - 1 AS ret
    FROM prices
),
trailing AS
(
    SELECT
        ticker,
        date,
        avg(ret) OVER (PARTITION BY ticker ORDER BY date ASC ROWS BETWEEN 251 PRECEDING AND CURRENT ROW) * 252 * 100 AS trailing_mean_pct,
        row_number() OVER (PARTITION BY ticker ORDER BY date ASC) AS i
    FROM rets
    WHERE isFinite(ret)
)
SELECT
    toString(toStartOfMonth(date))                     AS month,
    round(avgIf(trailing_mean_pct, ticker = 'SPY'), 1) AS spy_trailing_mean_pct,
    round(avgIf(trailing_mean_pct, ticker = 'KO'), 1)  AS ko_trailing_mean_pct
FROM trailing
WHERE i >= 252
  AND date >= '2017-01-01'
GROUP BY month
ORDER BY month ASC
$