{"slug":"finra-margin-debt-statistics","qid":"record_months","label":"Month-end closes that set a new high for the window, by year (SPY)","post_title":"FINRA Margin Debt Statistics, Explained","post_url":"/blog/finra-margin-debt-statistics#q-record_months","columns":["year","closes_observed","new_highs","cumulative_share_pct"],"rows":[{"year":"2006","closes_observed":12,"new_highs":8,"cumulative_share_pct":66.7},{"year":"2007","closes_observed":12,"new_highs":4,"cumulative_share_pct":50},{"year":"2008","closes_observed":12,"new_highs":0,"cumulative_share_pct":33.3},{"year":"2009","closes_observed":12,"new_highs":0,"cumulative_share_pct":25},{"year":"2010","closes_observed":12,"new_highs":0,"cumulative_share_pct":20},{"year":"2011","closes_observed":12,"new_highs":0,"cumulative_share_pct":16.7},{"year":"2012","closes_observed":12,"new_highs":0,"cumulative_share_pct":14.3},{"year":"2013","closes_observed":12,"new_highs":7,"cumulative_share_pct":19.8},{"year":"2014","closes_observed":12,"new_highs":8,"cumulative_share_pct":25},{"year":"2015","closes_observed":12,"new_highs":2,"cumulative_share_pct":24.2},{"year":"2016","closes_observed":12,"new_highs":4,"cumulative_share_pct":25},{"year":"2017","closes_observed":12,"new_highs":11,"cumulative_share_pct":30.6},{"year":"2018","closes_observed":12,"new_highs":3,"cumulative_share_pct":30.1},{"year":"2019","closes_observed":12,"new_highs":5,"cumulative_share_pct":31},{"year":"2020","closes_observed":12,"new_highs":4,"cumulative_share_pct":31.1},{"year":"2021","closes_observed":12,"new_highs":9,"cumulative_share_pct":33.9},{"year":"2022","closes_observed":12,"new_highs":0,"cumulative_share_pct":31.9},{"year":"2023","closes_observed":12,"new_highs":1,"cumulative_share_pct":30.6},{"year":"2024","closes_observed":12,"new_highs":9,"cumulative_share_pct":32.9},{"year":"2025","closes_observed":12,"new_highs":6,"cumulative_share_pct":33.8},{"year":"2026","closes_observed":8,"new_highs":4,"cumulative_share_pct":34.3}],"shape":"ranking","sql":"WITH daily AS\n(\n    SELECT\n        toDate(toTimeZone(window_start, 'America/New_York')) AS d,\n        argMax(close, window_start)                          AS px\n    FROM global_markets.delayed_stocks_minute_aggs\n    WHERE ticker = 'SPY'\n      AND window_start >= toDateTime('2006-01-01 00:00:00')\n      AND (toHour(toTimeZone(window_start, 'America/New_York')) * 60\n           + toMinute(toTimeZone(window_start, 'America/New_York'))) >= 570\n      AND (toHour(toTimeZone(window_start, 'America/New_York')) * 60\n           + toMinute(toTimeZone(window_start, 'America/New_York'))) < 960\n    GROUP BY d\n),\nmonth_close AS\n(\n    SELECT\n        toStartOfMonth(d)          AS m,\n        toFloat64(argMax(px, d))   AS close_px\n    FROM daily\n    GROUP BY m\n),\npeaks AS\n(\n    SELECT\n        m,\n        close_px,\n        max(close_px) OVER (ORDER BY m ASC\n            ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_peak\n    FROM month_close\n),\nper_year AS\n(\n    SELECT\n        toYear(m)                         AS y,\n        count()                           AS closes_observed,\n        countIf(close_px >= running_peak) AS new_highs\n    FROM peaks\n    GROUP BY y\n)\nSELECT\n    toString(y)      AS year,\n    closes_observed,\n    new_highs,\n    round(100 * sum(new_highs) OVER (ORDER BY y ASC\n              ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)\n              / sum(closes_observed) OVER (ORDER BY y ASC\n              ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), 1) AS cumulative_share_pct\nFROM per_year\nORDER BY y","computed_at":"2026-08-22T04:06:21.475321+00:00","elapsed":7.636992503}