Transaction-Cost Analysis and Slippage Attribution
Measuring execution quality past the fill.
§ IFrame
A fill report is not the end of the execution conversation. It is the line above which the conversation has been about what the operator intended, and below which the conversation becomes about what the operator received. The two are rarely equal. The gap between them is the cost the strategy paid to be in the market today, and the cost is itself a measurement that decides whether tomorrow's intent will be slightly different.
Last Friday's lesson named three execution disciplines: routing, fill reconciliation, position truth. Each operated forward from intent to acknowledgment to terminal state. Today's lesson runs the loop the other way. It begins at the fill record the reconciliation discipline produced, walks back to the strategy intent the routing discipline received, and asks the only question that matters past the fill: how much did the venue charge me, in basis points, for the privilege of acting on my conviction? The discipline that answers is transaction-cost analysis. The artifact it produces is slippage attribution. The reason the operator runs it daily is that adversarial markets do not announce when a venue has begun charging more.
§ IIFoundations — What TCA Owes the Strategy
Transaction-cost analysis owes the strategy four numbers and one verdict.
The first number is implementation shortfall. Defined plainly: the difference between the theoretical portfolio value the strategy would have built if every intent had filled instantly at the decision-time midprice, and the actual portfolio value the executor delivered. Shortfall is measured in basis points relative to traded notional. A strategy with a 12 bp signal that consistently realizes 6 bp of implementation shortfall is keeping half its edge. A strategy with a 12 bp signal realizing 14 bp of shortfall is paying to participate.
The second number is market-impact cost. Defined: the portion of shortfall attributable to the operator's own orders moving the price during the fill window. Computed by comparing the realized fill VWAP against the arrival-price midprice at the moment each child slice was sent. Impact rises with size, with urgency, and with thin books. Impact is the operator's cost of being a price-taker on volume the venue did not already want at the price the operator wanted.
The third number is timing cost. Defined: the portion of shortfall attributable to the price moving between the decision time and the first child slice send time. Timing cost catches latency in the strategy stack, queue delay at the venue gateway, network round trips that compound, and any pause the operator's risk gates introduced. Timing cost is the operator's cost of not being instant.
The fourth number is opportunity cost. Defined: the portion of intended notional that did not fill within the bracket, multiplied by the subsequent price move in the strategy's favor. Opportunity cost is the cost of having tried to be patient and missed the move. Three pair intents that expired in the worked example from last Friday carried real cost the executor must report.
The verdict is the single sentence the operator reads each morning: yesterday's strategy paid X basis points of implementation shortfall, of which Y was impact, Z was timing, W was opportunity, and the residual was venue fees. If X is within the strategy's edge band, the loop closes clean. If X is outside the band, the operator investigates before the next intent fires.
§ IIIMechanism — Three Operator Disciplines
Three disciplines compose the production TCA loop.
The first is arrival-price benchmarking. Every parent intent records the midprice at the moment the strategy released it to the executor. Every child slice records the midprice at the moment it left the executor's gateway. Every fill records the midprice at the moment the venue's matching engine crossed it. The three timestamps are not interchangeable. The arrival-price benchmark is the decision-time midprice; it is the reference against which every subsequent fill is measured. The discipline is that the arrival price is captured by the operator's own market-data feed at the same instant the strategy makes the decision, not pulled later from the venue's historical record. Venue history can rewrite itself; the operator's tick log cannot.
The second is per-slice attribution. Each child slice carries forward, in its fill record, the arrival price from its parent intent, the slice-send midprice, the realized fill price, and the venue fee. The four numbers permit decomposition: market impact is (fill VWAP minus slice-send midprice); timing cost is (slice-send midprice minus arrival midprice) times side-sign; venue fee is what the venue's fee schedule said it would be. Decomposition is per-slice because the executor sent multiple slices and each one experienced market conditions differently. Aggregation up to the parent intent is straightforward arithmetic once each slice is attributed.
The third is counterfactual reconstruction. For each intent, the TCA engine asks: what would the same intent have cost under a different routing decision? The counterfactual is built from the operator's own historical fill data plus the venue's published depth book at the relevant instant. The engine computes: had this intent been sent as a single market order, the cost would have been A bp; had it been sliced over twice the window, B bp; had it been routed to the alternate venue, C bp. The counterfactual matrix is the strategy's tuning input. The operator does not optimize blindly; the operator reads the matrix and adjusts the routing policy.
The three disciplines feed one observability stream. The stream emits per-fill records into the analytics store; the analytics store backs a daily TCA report; the daily TCA report is the artifact the strategy's portfolio manager reads before next day's open. The cadence cannot be longer than daily without losing the ability to react before the next day's intents fire. The cadence cannot be tighter than per-trade without overwhelming the operator's cognition. Daily is the negotiated mean.
§ IVWorked Example — Polymarket Pair Execution, Measured
A continuation of last Friday's worked example. The strategy fires forty pair intents across a trading day on Polymarket. Thirty-six pairs fill both sides within bracket. Two pairs fill one side. Two pairs expire. The fill log carries roughly two hundred fill events. Last Friday named what good execution looks like at the reconciliation layer. Today's lesson names what good execution looks like at the measurement layer.
The arrival-price benchmark for each pair intent is the midprice of both markets at the moment the strategy released the pair. The TCA engine reads the fill log, joins on parent-intent-ID, and produces a per-pair attribution: arrival price for each side, slice-send price for each child, fill VWAP for each side, venue fee, terminal-state code. The decomposition runs on the join.
The numbers from a clean execution day: implementation shortfall across the forty intents averages 4.2 bp per pair. Market impact contributes 2.8 bp of that; the long side of the pair was usually the deeper book and contributed less impact, while the short side was usually the thinner book and contributed more. Timing cost contributes 0.9 bp; the executor's median time between intent receipt and first child send is 180 ms, and the typical book moves about 5 bp per second on these markets, so the arithmetic is consistent. Opportunity cost contributes 0.4 bp from the two expired pairs that moved an average of 8 bp in the strategy's favor over the bracket window. Venue fees contribute 0.1 bp because Polymarket maker rebates partially offset the taker fees on the matched legs. The residual is noise.
The verdict for the clean day: the strategy paid 4.2 bp to deploy a 12 bp signal. The edge band is preserved at 7.8 bp. The routing policy is correct. The slicing window is correct. The bracket deadline is correct. The operator files the report and approves the next day's intents.
The numbers from a day where execution is almost working: implementation shortfall jumps to 9.1 bp. The decomposition reveals where. Market impact is 5.7 bp, up from 2.8 — almost doubling. Timing cost is 1.0 bp, unchanged. Opportunity cost is 0.3 bp, unchanged. The fee line is unchanged. Counterfactual reconstruction runs: had this day's intents been sliced over double the window, market impact would have been 3.4 bp. The operator reads the counterfactual and the diagnosis is named: the slicing window was too tight for the day's book depth. The book had thinned overnight; the same slice schedule that worked yesterday paid double today. The operator widens the window for tomorrow.
The numbers from the dangerous day: implementation shortfall is 6.8 bp, within the edge band. The verdict would have read clean if the operator stopped at the headline. The decomposition tells a different story. Market impact is 2.6 bp, normal. Timing cost is 3.9 bp, up four-fold from baseline. Venue fees are unchanged. The diagnosis: a network path between the executor and the venue gateway has begun adding 800 ms of latency. The strategy's edge is durable enough today that 3.9 bp of timing cost did not blow the edge band. Tomorrow, with a stronger signal opportunity, the same 3.9 bp would blow it. The operator routes around the degraded network path before tomorrow's open. The TCA report caught the problem before the strategy's PnL did.
§ VConnection to Prior Lessons
This lesson closes a three-lesson γ-pair arc. The 2026-05-22 signal-pipeline lesson named the upstream side: ingest, normalize, filter, score, size. The 2026-05-29 execution lesson named the middle: route, reconcile, verify position. Today's lesson names the downstream side: measure, attribute, decide. Together the three lessons compose what a single γ operator must run before the first intent of the morning and after the last fill of the afternoon. None of the three works without the other two; a signal pipeline with no execution discipline ships intents into a void, and an execution discipline with no measurement loop runs blind to its own degradation.
The 2026-05-26 AWS credential-architecture cert lesson sits adjacent to this one. The TCA engine reads from the analytics store; the analytics store reads from the fill log; the fill log is written by the executor whose venue API credentials were exactly the IAM-and-Secrets-Manager problem that lesson addressed. The chain from credential to fill to attribution is one chain. A leak anywhere in the chain breaks the loop the operator just spent a daily cycle measuring.
The 2026-05-28 audit-trail lesson named the integrity guarantee the analytics store inherits. The same hash-chained audit log that protects the executor's outgoing requests protects the fill events arriving back. The TCA engine reads from a fill log that the audit chain has signed. The operator's confidence in the attribution numbers is conditional on the audit log's integrity.
§ VIConnection to Today's Dev Lesson
The Python lesson today addresses the arithmetic the TCA engine cannot get wrong without poisoning the verdict. Implementation shortfall is computed in basis points; basis points are quantities of one part in ten thousand; the inputs are venue prices that arrive as decimal strings with venue-specific tick conventions. Mixing those inputs through Python's native float type is a discipline failure that produces TCA reports the operator cannot defend. The Dev lesson works through decimal.Decimal, the quantization context, the tick-rounding discipline that aligns operator-internal prices with venue-acknowledged prices, and the NumPy-integer-tick pattern that scales the discipline to vectorized backtests without re-introducing float drift.
The two lessons compose. The Ops side names what TCA owes the strategy. The Dev side names what Python owes the TCA engine. An operator who reads only the Ops side ships a system whose arithmetic silently corrupts the verdict; an operator who reads only the Dev side ships a system whose verdict is precise but answers the wrong question. Both are required.
§ VIIClosing
Execution does not end at the fill. It ends at the verdict the operator reads the next morning, in basis points, with attribution. The verdict is what the strategy uses to decide whether yesterday's routing decisions earned their cost. Without the verdict, the routing decisions are tradition rather than choice; with the verdict, the routing decisions are a daily contest between intent and outcome that the operator slowly wins.
The discipline is not optional. Every adversarial-markets operator who has lost capital has lost some of it to execution decay the TCA loop would have caught. The operator who runs the loop daily loses less. The operator who runs the loop weekly loses sometimes. The operator who does not run the loop loses always, and finds out at the next quarter's PnL review.
Examine well. Reflect on this.