Execution & transaction costs
A signal is only half a strategy. The other half is getting the trade done at a price close enough to the one your backtest assumed that the edge survives. Most researched edges are real on paper and dead in production for one reason: execution costs. This chapter quantifies where those costs come from — slippage and market impact, temporary and permanent — states the square-root impact law, walks through the execution algos that manage it, defines implementation shortfall as the honest scorecard, and shows how transaction-cost analysis and capacity limits decide whether a signal is worth trading at all.
Why execution matters#
The trap is the difference between gross and net edge. A signal with a healthy gross profit factor can have a negative net one the moment costs are subtracted — and the faster it trades, the more times it pays. From the metrics chapter, an edge is judged on expectancy in R; costs are subtracted from every trade before that expectancy is computed:
When approaches gross expectancy, the edge vanishes. This is not a haircut you apply at the end — it is a survival test. A great signal dies on costs quietly: the equity curve just tilts a few basis points per trade until it points down.
Slippage and market impact#
Slippage is the gap between the price you expected and the price you got. Part of it is the spread from the last chapter; the rest is market impact — the fact that your own order moves the price against you as it consumes liquidity. Impact splits into two kinds:
Temporary impact is the concession you pay for demanding immediacy: you walk the book, depth refills after you are done, and the price snaps back. It is a cost of how you traded and it decays.
Permanent impactis the information your trade reveals: the market infers that a large buyer knows something, and the price stays elevated. It is a lasting shift in the mid that does not come back — the adverse-selection cost from the previous chapter, seen from the taker's side.
The square-root law#
The central empirical regularity of impact: the price concession from trading a quantity against a daily volume grows not linearly but as the square root of participation:
where is the asset's volatility and the fraction of daily volume you represent. Two consequences drive everything downstream. First, impact is concave: doubling your size less-than-doubles your cost, so there is a real benefit to trading larger — up to a point. Second, and more important, cost per share rises with size ( falls, but total impact still climbs), and the term is what eventually caps a strategy's capacity.

Execution algorithms#
The whole job of an execution algo is to manage the trade-off the square-root law creates: trade too fast and you pay impact; trade too slow and you carry timing risk — the price may drift away before you finish. Three canonical schedules:
TWAP (time-weighted average price): slice the order into equal pieces spaced evenly over a fixed window. Simple, predictable, ignores volume — good when you want a steady, low-footprint schedule and do not trust volume forecasts.
VWAP (volume-weighted average price): slice in proportion to expected volume, trading more when the market is busy and less when it is thin. The benchmark most institutions are measured against, because participating in proportion to volume minimises footprint for a given size.
POV (percentage of volume): trade a fixed fraction of whatever volume actually prints in real time — say 10% of every trade — so your participation is capped no matter how the day develops. Adapts to realised liquidity at the cost of an uncertain completion time.
Implementation shortfall#
The honest scorecard for execution is implementation shortfall (IS): the difference between the price at the moment you decided to trade (the decision or arrival price) and the average price you actually filled at, plus the opportunity cost of anything you failed to execute:
IS captures what a backtest hides. Your backtest fills at (or worse, the close); reality fills at after spread, impact, and delay. The shortfall is the leakage between simulated and live P&L — and it is precisely the quantity your cost model is trying to estimate in advance.
• Execution cost = — what you paid above your decision price on the shares you got.
• Opportunity cost = — the profit you forfeited on the shares you failed to buy while the price moved away.
Total IS = , or of the intended notional. Your backtest, filling all 1m shares instantly at $50.00, recorded zero of this. IS is the honest gap between that fantasy and the trade you actually did.
Transaction-cost analysis#
TCA is the post-trade discipline of measuring realised execution cost — decomposing each fill into spread, temporary impact, permanent impact, and timing — and feeding it back into both the cost model and the choice of execution algo. In research you run TCA forward: you assume a cost, and then you stress it. edgekit's harness does exactly this — re-run the strategy at escalating multiples of your baseline cost and watch what happens to the metrics:
import edgekit as ek
def run(cost: ek.costs.CostModel) -> dict:
r = backtest_returns_in_R(cost) # your strategy, charged this cost
return ek.metrics.trade_stats(r)
grid = ek.validation.cost_stress(
run,
base=ek.costs.CostModel(spread_rt=0.0012, swap_day=0.0002),
mults=(1.0, 2.0, 3.0),
)
for m, stats in grid.items():
print(f"{m}x cost -> PF {stats['pf']:.2f}, EV {stats['ev_r']:.3f}R")
The survivor rule of thumb is blunt: profit factor must stay above 1 at 2x and 3x your baseline cost. A genuine edge has margin; a curve-fit one is a knife-edge that the first realistic cost estimate tips over. This is validation gauntlet stage #6, and it is the direct enforcement of the microstructure lesson — the spread is not optional, so prove the edge outlives it.
Capacity and liquidity limits#
The square-root law implies a hard ceiling. As you scale capital, rises, impact grows, and net expectancy per trade shrinks — until, at some size, the marginal trade's cost equals its gross edge and adding capital destroys return. That size is the strategy's capacity. Fast, small-edge, high-turnover strategies have low capacity (they pay the spread constantly and saturate thin books); slow, large-edge, low-turnover strategies have high capacity. Capacity is not a footnote — it decides whether an edge is a personal-account curiosity or an institutional business, and it must be estimated from the same impact model that sets your costs.
This closes the loop with why backtests lie: the cost-sensitivity curve is the antidote to the most expensive pitfall — a gross edge that never survived contact with the book. With execution understood, the remaining frontier is modelling the price process itself.
Next: ARIMA & GARCH — the classical time-series models for the conditional mean and conditional variance that underlie much of what we have priced and traded here.

