{"slug":"stock-order-types-explained","qid":"limit_fill","label":"How often a buy limit under the prior close was reached (AAPL, one year of sessions)","post_title":"Stock Order Types Explained: The Core Four","post_url":"/blog/stock-order-types-explained#q-limit_fill","columns":["limit_below_prior_close","sessions_filled_pct"],"rows":[{"limit_below_prior_close":"0%","sessions_filled_pct":87.2},{"limit_below_prior_close":"0.25%","sessions_filled_pct":74.4},{"limit_below_prior_close":"0.5%","sessions_filled_pct":62.8},{"limit_below_prior_close":"1%","sessions_filled_pct":41.2},{"limit_below_prior_close":"2%","sessions_filled_pct":12.8},{"limit_below_prior_close":"3%","sessions_filled_pct":4}],"shape":"ranking","sql":"WITH sessions AS\n(\n    SELECT\n        date,\n        toFloat64(any(low))   AS low_px,\n        toFloat64(any(close)) AS close_px\n    FROM global_markets.stocks_daily_aggs\n    WHERE ticker = 'AAPL'\n      AND date >= '2025-10-01'\n      AND date <  '2026-10-01'\n    GROUP BY date\n),\nframed AS\n(\n    SELECT\n        low_px,\n        lagInFrame(close_px) OVER (\n            ORDER BY date ASC\n            ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) AS prev_close\n    FROM sessions\n)\nSELECT\n    concat(toString(offset_pct), '%')                AS limit_below_prior_close,\n    round(100 * countIf(low_px <= prev_close * (1 - offset_pct / 100))\n              / count(), 1)                          AS sessions_filled_pct\nFROM framed\nARRAY JOIN [0., 0.25, 0.5, 1., 2., 3.] AS offset_pct\nWHERE prev_close > 0\nGROUP BY offset_pct\nORDER BY offset_pct","computed_at":"2026-10-08T15:17:40.393945+00:00","elapsed":0.008109468}