{"slug":"buy-limit-vs-sell-limit-orders","qid":"touch_by_year","label":"A 1% buy limit vs a 1% sell limit: share of SPY sessions reached, by year","post_title":"Buy Limit vs Sell Limit Orders Explained","post_url":"/blog/buy-limit-vs-sell-limit-orders#q-touch_by_year","columns":["year","buy_limit_touched_pct","sell_limit_touched_pct"],"rows":[{"year":2021,"buy_limit_touched_pct":17.1,"sell_limit_touched_pct":17.9},{"year":2022,"buy_limit_touched_pct":45.8,"sell_limit_touched_pct":38.6},{"year":2023,"buy_limit_touched_pct":18.8,"sell_limit_touched_pct":22},{"year":2024,"buy_limit_touched_pct":14.3,"sell_limit_touched_pct":18.7},{"year":2025,"buy_limit_touched_pct":23.2,"sell_limit_touched_pct":18.8},{"year":2026,"buy_limit_touched_pct":19.3,"sell_limit_touched_pct":15.5}],"shape":"ranking","sql":"WITH daily AS\n(\n    SELECT\n        date,\n        toFloat64(any(close)) AS close,\n        toFloat64(min(low))   AS low,\n        toFloat64(max(high))  AS high\n    FROM global_markets.stocks_daily_aggs\n    WHERE ticker = 'SPY'\n      AND date >= '2021-01-01'\n      AND date <  '2026-10-01'\n    GROUP BY date\n),\nframed AS\n(\n    SELECT\n        date,\n        low,\n        high,\n        lagInFrame(close, 1) OVER (ORDER BY date ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS prior_close\n    FROM daily\n)\nSELECT\n    toYear(date) AS year,\n    round(100 * countIf(low  <= prior_close * 0.99) / count(), 1) AS buy_limit_touched_pct,\n    round(100 * countIf(high >= prior_close * 1.01) / count(), 1) AS sell_limit_touched_pct\nFROM framed\nWHERE prior_close > 0\nGROUP BY year\nORDER BY year","computed_at":"2026-10-05T14:51:08.680433+00:00","elapsed":0.00360595}