{"slug":"what-is-the-opening-auction","qid":"aapl_open_receipt","label":"The receipt: AAPL's opening cross vs. everything that traded before it, July 1-2, 2026","post_title":"What Is the Opening Auction? How Stocks Open","post_url":"/blog/what-is-the-opening-auction#q-aapl_open_receipt","columns":["spy_session_bars_jul02","jul01_close_print_count","prior_close_price","opening_print_count","auction_price","auction_et","overnight_gap_pct","first_trade_et","first_trade_price","trades_before_official_open","bell_to_cross_trades","official_open_msgs","listing_venue_open_msgs","listing_open_msg_price_difference"],"rows":[{"spy_session_bars_jul02":390,"jul01_close_print_count":1,"prior_close_price":294.38,"opening_print_count":1,"auction_price":294.1,"auction_et":"09:30:00.491313","overnight_gap_pct":-0.1,"first_trade_et":"04:00:00","first_trade_price":296.1,"trades_before_official_open":15832,"bell_to_cross_trades":173,"official_open_msgs":2,"listing_venue_open_msgs":1,"listing_open_msg_price_difference":0}],"shape":"scalar","sql":"WITH\n    (\n        SELECT countIf(window_start >= toDateTime('2026-07-02 09:30:00', 'America/New_York') AND window_start < toDateTime('2026-07-02 16:00:00', 'America/New_York'))\n        FROM global_markets.delayed_stocks_minute_aggs\n        WHERE ticker = 'SPY' AND window_start >= toDateTime('2026-07-02 00:00:00', 'America/New_York') AND window_start < toDateTime('2026-07-03 00:00:00', 'America/New_York')\n    ) AS bars_jul02,\n    (\n        SELECT argMax(sip_timestamp, (size, sip_timestamp))\n        FROM global_markets.stocks_trades\n        WHERE ticker = 'AAPL' AND sip_timestamp >= '2026-07-02 00:00:00' AND sip_timestamp < '2026-07-03 00:00:00' AND has(conditions, 17)\n    ) AS auction_ts,\n    (\n        SELECT argMax(exchange, (size, sip_timestamp))\n        FROM global_markets.stocks_trades\n        WHERE ticker = 'AAPL' AND sip_timestamp >= '2026-07-02 00:00:00' AND sip_timestamp < '2026-07-03 00:00:00' AND has(conditions, 17)\n    ) AS listing_exchange\nSELECT\n    bars_jul02 AS spy_session_bars_jul02,\n    countIf(has(conditions, 8) AND sip_timestamp < '2026-07-02 00:00:00') AS jul01_close_print_count,\n    toFloat64(argMaxIf(price, (size, sip_timestamp), has(conditions, 8) AND sip_timestamp < '2026-07-02 00:00:00')) AS prior_close_price,\n    countIf(has(conditions, 17) AND sip_timestamp >= '2026-07-02 00:00:00') AS opening_print_count,\n    toFloat64(argMaxIf(price, (size, sip_timestamp), has(conditions, 17) AND sip_timestamp >= '2026-07-02 00:00:00')) AS auction_price,\n    formatDateTime(toTimeZone(auction_ts, 'America/New_York'), '%H:%i:%S.%f') AS auction_et,\n    round(100 * (toFloat64(argMaxIf(price, (size, sip_timestamp), has(conditions, 17) AND sip_timestamp >= '2026-07-02 00:00:00')) - toFloat64(argMaxIf(price, (size, sip_timestamp), has(conditions, 8) AND sip_timestamp < '2026-07-02 00:00:00'))) / toFloat64(argMaxIf(price, (size, sip_timestamp), has(conditions, 8) AND sip_timestamp < '2026-07-02 00:00:00')), 2) AS overnight_gap_pct,\n    formatDateTime(toTimeZone(minIf(sip_timestamp, sip_timestamp >= '2026-07-02 00:00:00' AND NOT hasAny(conditions, [15, 16, 38])), 'America/New_York'), '%H:%i:%S') AS first_trade_et,\n    toFloat64(argMinIf(price, (sip_timestamp, sequence_number), sip_timestamp >= '2026-07-02 00:00:00' AND NOT hasAny(conditions, [15, 16, 38]))) AS first_trade_price,\n    countIf(sip_timestamp >= '2026-07-02 00:00:00' AND sip_timestamp < auction_ts AND NOT hasAny(conditions, [15, 16, 38])) AS trades_before_official_open,\n    countIf(sip_timestamp >= toDateTime('2026-07-02 09:30:00', 'America/New_York') AND sip_timestamp < auction_ts AND NOT hasAny(conditions, [15, 16, 38])) AS bell_to_cross_trades,\n    countIf(has(conditions, 16) AND sip_timestamp >= '2026-07-02 00:00:00') AS official_open_msgs,\n    countIf(has(conditions, 16) AND sip_timestamp >= '2026-07-02 00:00:00' AND exchange = listing_exchange) AS listing_venue_open_msgs,\n    round(toFloat64(anyIf(price, has(conditions, 16) AND sip_timestamp >= '2026-07-02 00:00:00' AND exchange = listing_exchange)) - toFloat64(argMaxIf(price, (size, sip_timestamp), has(conditions, 17) AND sip_timestamp >= '2026-07-02 00:00:00')), 4) AS listing_open_msg_price_difference\nFROM global_markets.stocks_trades\nWHERE ticker = 'AAPL' AND sip_timestamp >= '2026-07-01 00:00:00' AND sip_timestamp < '2026-07-03 00:00:00'","computed_at":"2026-07-26T06:24:34.711016+00:00","elapsed":0.717623799}