Market microstructure is one of those topics where the academic literature and the practical trading reality diverge more than they should. The concepts (spread, queue priority, adverse selection, price impact) are well-documented in research going back decades. What is less well-documented is how to construct the post-trade measurement framework that tells you, for your specific strategy and your specific execution infrastructure, how much each of these factors is actually costing you.
This post is about measurement, not theory. We will describe the specific statistics we track and how they map to execution cost components that are actionable through infrastructure and routing improvements.
The Execution Cost Decomposition
Total execution cost is typically expressed as implementation shortfall: the difference between the theoretical value of your order at decision time and the actual realized value after execution. Implementation shortfall decomposes into four components:
- Spread cost: the half-spread paid to cross from passive to aggressive side of the market
- Price impact: the market movement your own order causes before it is fully filled
- Delay cost: the price movement between when your signal fired and when you submitted the order
- Adverse selection: the component attributable to informed order flow arriving before your fill completes
For small orders (say, under 0.1% of average daily volume), price impact is usually negligible. Delay cost and adverse selection are where infrastructure quality shows up most directly, because both are partially functions of how fast your pipeline moves from signal to fill.
Measuring Delay Cost
Delay cost requires two timestamps: the time at which your signal evaluated to a trading decision, and the time at which your order was acknowledged at the exchange. The difference is your end-to-end execution latency for that order. Multiply by the price movement over that interval and you have the delay cost for that trade.
In practice this is harder than it sounds because "price movement over that interval" requires a clean reference price. Using the midpoint at decision time as reference is standard (this is the arrival price in implementation shortfall terminology). The midpoint at acknowledgment time from the exchange's last reported trade or quote is the exit reference.
Plotting delay cost distribution across your order population reveals whether your infrastructure latency is materially contributing to execution cost. In a low-latency environment where routing runs in under 50 us and the exchange round-trip adds another 50 to 150 us, a typical equity will move less than 0.1 basis points in that window. If your distribution shows mean delay cost of 0.5 bps or more, your pipeline latency is long enough to be a measurable cost driver.
Measuring Adverse Selection
Adverse selection is the most subtle component. When you buy passively at the bid and the market subsequently moves against you (price declines after your buy), a portion of that move is attributable to other, better-informed participants also transacting in the same direction at the same time. Your fill was the result of an informed seller being willing to cross the spread to trade with you, which often means you were on the wrong side of the information advantage at that moment.
The standard measurement is post-trade price drift. Take the midpoint immediately after your fill and compare it to the midpoint at successive intervals: 100 ms, 1 second, 10 seconds. For a random order that is not adversely selected, the expected price drift at each interval is zero (it may be noisy, but the mean across a large sample should be near zero). For adversely selected fills, the mean drift is negative for buys (and positive for sells).
A useful decomposition by routing source: compare adverse selection rates for fills routed to a single primary venue versus fills from a smart order routing approach that splits across venues. In our experience, orders filled at the lit exchange with the highest visible queue depth tend to have lower adverse selection rates than fills at venues with lower visible liquidity, because depth is a partial proxy for market maker participation and market makers tend to reduce their adverse selection exposure by maintaining tighter quotes at deeper venues.
Queue Position Effects
Passive orders (limit orders resting in the order book) experience a different microstructure cost profile than aggressive orders. The relevant statistic for passive execution is fill probability by queue position: if you are third in the queue at your price level, what fraction of the available quantity at that level do you typically fill before the market moves?
Measuring this requires knowing your queue position at time of order entry, which means consuming depth-of-book data and tracking the sequence of orders ahead of yours at each price level. For ITCH-based feeds, this is straightforward: ITCH provides order-by-order tracking of all activity at every price level, so you can reconstruct your position in the queue precisely. For aggregated feeds that only publish total depth at each level, you need to estimate queue position from the published depth at the time of your order entry relative to subsequent fills.
The actionable finding from queue position analysis is typically that orders submitted earlier in a price level's lifetime have significantly better fill rates than orders submitted late. If your routing logic targets a price level that has already been established and has significant depth ahead of you, the probability of a full fill at that price is low, and you should consider being more aggressive (accepting spread cost) or targeting a different venue with lower queue depth at the same price.
The Infrastructure Connection
Delay cost and adverse selection both have infrastructure leverage points. Reducing end-to-end pipeline latency directly reduces delay cost. Improving routing quality, specifically routing to venues where your order has better queue position or lower adverse selection exposure, reduces adverse selection cost. These are not abstract benefits of better infrastructure. They show up as measurable differences in fill statistics when you track them correctly.
We want to be clear about what infrastructure cannot fix. If your strategy's signal is inherently weak (low Sharpe, high noise), better execution infrastructure will reduce your costs but it will not save a losing strategy. Microstructure measurement is most valuable when you have a strategy with a genuine edge and you are trying to recover as much of that edge as possible in execution. The measurement framework we have described here is designed for that scenario.
Building the Post-Trade Analytics Pipeline
The measurement approach described above requires a post-trade analytics pipeline that joins execution records with market data at sub-second granularity. The specific data requirements: order logs with decision timestamps (not just submission timestamps), full execution reports from the exchange including fill timestamps and prices, and a synchronized market data store with midpoint prices at nanosecond precision.
The nanosecond-precision market data store is the difficult part. Most analytics databases are not designed for sub-millisecond time resolution. kdb+ is the standard choice in institutional trading for this reason, but ClickHouse with proper timestamp indexing is a viable lower-cost alternative for teams that do not want to invest in kdb+ licensing and expertise.
The analysis itself is relatively standard: join on symbol, align timestamps, compute the metrics described above, aggregate by routing strategy, venue, time of day, and market condition buckets. The value is in running it consistently and acting on what it shows.