0bps

Learn / Track VII / lesson 4 of 4

Execution: TWAP, VWAP and implementation shortfall

How large orders are sliced over time, the trade-off between impact and risk, and the Almgren–Chriss answer to it.

10 min read

A strategy decides what position to hold. An execution algorithm decides how to get there without paying more than necessary in market impact.

The core trade-off

Trade fast and you pay more impact. Trade slowly and you carry more risk that the price moves away before you finish. Every execution algorithm is a choice along that line.

TWAP

Time-weighted average price: split the parent order into equal slices at equal time intervals. To buy QQ over NN intervals, buy Q/NQ/N each interval.

Simple, predictable and good when volume is roughly uniform. Its weakness is that it’s predictable — other participants can detect a mechanical pattern — so practical versions randomise slice size and timing.

VWAP

Volume-weighted average price: trade in proportion to the market’s expected volume profile, more when the market is active and less when it’s quiet. For equities, intraday volume is U-shaped (heavy at the open and close); crypto volume follows global session overlaps.

VWAP=∑ipivi∑ivi\text{VWAP} = \frac{\sum_i p_i v_i}{\sum_i v_i}

Matching the market’s VWAP is a common benchmark because it is hard to look bad against: you traded like the average participant.

POV

Percentage of volume: participate at a fixed fraction (say 10%) of real-time market volume. It adapts to actual activity but has no fixed finish time.

Implementation shortfall and Almgren–Chriss

The Almgren–Chriss (2000) framework makes the trade-off explicit. With linear temporary impact η\eta, volatility σ\sigma and risk aversion λ\lambda, the optimal holding trajectory to liquidate XX shares over horizon TT is

x(t)=X sinh⁡(κ(T−t))sinh⁡(κT),κ=λ σ2ηx(t) = X\,\frac{\sinh\big(\kappa (T - t)\big)}{\sinh(\kappa T)}, \qquad \kappa = \sqrt{\frac{\lambda\,\sigma^2}{\eta}}
  • When risk aversion is near zero, κ→0\kappa \to 0 and the trajectory becomes a straight line: TWAP.
  • When risk aversion is high, κ\kappa is large and the algorithm front-loads trading to cut risk quickly, accepting more impact.
Practical execution rules
  • Rest limit orders first and fall back to marketable orders only when the schedule falls behind.
  • Never let a child order exceed a cap relative to visible depth.
  • Measure every parent order against its arrival price and log the shortfall. If you don’t measure execution cost, you are almost certainly underestimating it.
  • Make every child order idempotent with a client order ID, so retries after timeouts never double-fill. See from spec to live system.

Build this idea

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build an execution service with TWAP and VWAP schedulers, child-order slicing, limit-then-market fallback, idempotent order IDs, and an implementation-shortfall report per parent order
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch
esc

Try , , or .

↑↓ move↵ open