{"slug":"when-did-the-us-stock-market-start","qid":"annual_closures","label":"Weekdays with no US equity session, 2014 through 2023","post_title":"When Did the US Stock Market Start? 1792","post_url":"/blog/when-did-the-us-stock-market-start#q-annual_closures","columns":["year","weekday_closures"],"rows":[{"year":"2014","weekday_closures":9},{"year":"2015","weekday_closures":9},{"year":"2016","weekday_closures":9},{"year":"2017","weekday_closures":9},{"year":"2018","weekday_closures":10},{"year":"2019","weekday_closures":9},{"year":"2020","weekday_closures":9},{"year":"2021","weekday_closures":9},{"year":"2022","weekday_closures":9},{"year":"2023","weekday_closures":10}],"shape":"ranking","sql":"SELECT\n    toString(toYear(cal.day))           AS year,\n    countIf(ifNull(s.sessions, 0) = 0)  AS weekday_closures\nFROM\n(\n    SELECT toDate('2014-01-01') + arrayJoin(range(3652)) AS day\n) AS cal\nLEFT JOIN\n(\n    SELECT\n        date     AS d,\n        count()  AS sessions\n    FROM global_markets.stocks_daily_aggs\n    WHERE ticker = 'SPY'\n      AND date >= '2014-01-01'\n      AND date <  '2024-01-01'\n    GROUP BY d\n) AS s ON s.d = cal.day\nWHERE toDayOfWeek(cal.day) BETWEEN 1 AND 5\n  AND cal.day < toDate('2024-01-01')\nGROUP BY year\nORDER BY year","computed_at":"2026-08-08T15:40:30.240721+00:00","elapsed":0.547716487}