{"slug":"what-is-a-liquidity-sweep","qid":"sweep_day_peak","label":"Volume in the fifteen minutes that printed the high, beside the session's median and busiest slices","post_title":"What Is a Liquidity Sweep in Trading?","post_url":"/blog/what-is-a-liquidity-sweep#q-sweep_day_peak","columns":["label","volume_millions"],"rows":[{"label":"Fifteen minutes that printed the session high","volume_millions":2.48},{"label":"Median fifteen-minute slice of the session","volume_millions":4.63},{"label":"Busiest fifteen-minute slice of the session","volume_millions":12.88}],"shape":"ranking","sql":"SELECT\n    tupleElement(entry, 1) AS label,\n    tupleElement(entry, 2) AS volume_millions\nFROM\n(\n    SELECT\n        arrayJoin([\n            ('Fifteen minutes that printed the session high', peak_slice),\n            ('Median fifteen-minute slice of the session',    median_slice),\n            ('Busiest fifteen-minute slice of the session',   busiest_slice)\n        ]) AS entry\n    FROM\n    (\n        SELECT\n            round(argMax(volume_mm, (slice_high, slice_start)), 2) AS peak_slice,\n            round(quantileExact(0.5)(volume_mm), 2)                AS median_slice,\n            round(max(volume_mm), 2)                               AS busiest_slice\n        FROM\n        (\n            SELECT\n                toStartOfFifteenMinutes(toTimeZone(window_start, 'America/New_York')) AS slice_start,\n                toFloat64(max(high))                                                  AS slice_high,\n                toFloat64(sum(volume)) / 1e6                                          AS volume_mm\n            FROM global_markets.delayed_stocks_minute_aggs\n            WHERE ticker = 'SPY'\n              AND window_start >= '2025-01-01'\n              AND window_start <  '2026-01-02'\n              AND toDate(toTimeZone(window_start, 'America/New_York')) =\n              (\n                  SELECT toDate(date)\n                  FROM\n                  (\n                      SELECT\n                          date,\n                          hi,\n                          cl,\n                          lagInFrame(hi) OVER (ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS prior_hi\n                      FROM\n                      (\n                          SELECT\n                              date,\n                              argMax(high,  _ingest_time) AS hi,\n                              argMax(close, _ingest_time) AS cl\n                          FROM global_markets.stocks_daily_aggs\n                          WHERE ticker = 'SPY'\n                            AND date >= '2024-12-31'\n                            AND date <  '2026-01-01'\n                          GROUP BY date\n                      )\n                  )\n                  WHERE date >= '2025-01-01'\n                    AND prior_hi > 0\n                    AND hi > prior_hi\n                    AND cl < prior_hi\n                  ORDER BY (toFloat64(hi) - toFloat64(prior_hi)) / toFloat64(prior_hi) DESC, date DESC\n                  LIMIT 1\n              )\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 slice_start\n        )\n    )\n)","computed_at":"2026-09-19T15:04:29.701453+00:00","elapsed":0.31236066}