{"slug":"backtesting-in-illiquid-markets","qid":"touch_depth","label":"touch_depth","post_title":"backtesting-in-illiquid-markets","post_url":"/blog/backtesting-in-illiquid-markets#q-touch_depth","columns":["ticker","quoted_spread_bps","avg_touch_shares","quote_updates"],"rows":[{"ticker":"KO","quoted_spread_bps":1.3,"avg_touch_shares":43678,"quote_updates":75853},{"ticker":"SPY","quoted_spread_bps":0.2,"avg_touch_shares":26933,"quote_updates":586907},{"ticker":"SJM","quoted_spread_bps":19.5,"avg_touch_shares":17566,"quote_updates":5127},{"ticker":"AAPL","quoted_spread_bps":1.3,"avg_touch_shares":11527,"quote_updates":148339}],"shape":"ranking","sql":"SELECT\n    ticker,\n    round(avg(toFloat64(ask_price) - toFloat64(bid_price))\n          / avg((toFloat64(ask_price) + toFloat64(bid_price)) / 2) * 10000, 1) AS quoted_spread_bps,\n    round(avg(toFloat64(bid_size + ask_size) / 2) * 100, 0)                    AS avg_touch_shares,\n    count()                                                                    AS quote_updates\nFROM global_markets.cache_stocks_quotes\nWHERE ticker IN ('SPY', 'AAPL', 'KO', 'SJM', 'LANC')\n  AND sip_timestamp >= '2026-09-16 00:00:00'\n  AND sip_timestamp <  '2026-09-17 00:00:00'\n  AND (toHour(toTimeZone(sip_timestamp, 'America/New_York')) * 60\n       + toMinute(toTimeZone(sip_timestamp, 'America/New_York'))) >= 600\n  AND (toHour(toTimeZone(sip_timestamp, 'America/New_York')) * 60\n       + toMinute(toTimeZone(sip_timestamp, 'America/New_York'))) < 720\n  AND bid_price > 0\n  AND ask_price > bid_price\nGROUP BY ticker\nORDER BY avg_touch_shares DESC","computed_at":"2026-10-01T16:17:33.844054+00:00","elapsed":0.003364989}