Skip to content
LeetQuant
E08 Advanced Market Microstructure

E08 · Advanced Market Microstructure · Lesson 3 of 4

Market Impact and Execution

Almgren–Chriss optimal execution derived: the impact-versus-risk trade-off, the sinh trajectory and its numbers, why VWAP is optimal under participation-based impact, and implementation shortfall as the objective.

19 min

Objective

Derive the Almgren–Chriss optimal liquidation schedule, compute its cost and risk for a concrete order, explain what the urgency parameter does, and show when TWAP and VWAP are the optimal answers. The order-flow lesson introduced temporary and permanent impact and the square-root law; here we turn those into a schedule.

Intuition

You must sell XX shares by time TT. Selling fast pushes the price down (temporary impact grows with trading rate). Selling slowly leaves you holding shares while the price wanders (risk grows with inventory held over time). A risk-neutral trader minimises expected cost and spreads trades evenly. A risk-averse trader accepts a little more expected cost to cut the variance, which means selling more at the start, when inventory is largest.

The model

Let x(t)x(t) be shares still held, with x(0)=Xx(0) = X, x(T)=0x(T) = 0, and trading rate v(t)=−x˙(t)v(t) = -\dot{x}(t). The unaffected price follows arithmetic Brownian motion with volatility σ\sigma (dollars per share per time\sqrt{\text{time}}).

  • Permanent impact: each share sold lowers the price by γ\gamma for good. Its total cost is 12γX2\tfrac12\gamma X^2 whatever the schedule, so it does not affect the optimisation.
  • Temporary impact: shares sold at rate vv receive ηv\eta v less per share, so the cost per unit time is ηv2\eta v^2. (A fixed half-spread cost ε\varepsilon per share adds εX\varepsilon X, also schedule-independent.)

Measured against the arrival price, the cost of the schedule (its implementation shortfall) has

E[C]=12γX2+η∫0Tx˙(t)2 dt,Var⁡[C]=σ2∫0Tx(t)2 dt,\mathbb{E}[C] = \tfrac12\gamma X^2 + \eta\int_0^T \dot{x}(t)^2\,dt, \qquad \operatorname{Var}[C] = \sigma^2\int_0^T x(t)^2\,dt,

the variance coming from price moves on the shares not yet sold. Minimise the mean-variance objective E[C]+λVar⁡[C]\mathbb{E}[C] + \lambda\operatorname{Var}[C], where λ\lambda is risk aversion in units of 1/dollars.

The solution

The integrand is ηx˙2+λσ2x2\eta\dot{x}^2 + \lambda\sigma^2 x^2. The Euler–Lagrange equation gives

x¨=κ2x,κ=λσ2η,\ddot{x} = \kappa^2 x, \qquad \kappa = \sqrt{\frac{\lambda\sigma^2}{\eta}},

and with the boundary conditions,

x(t)=X sinh⁡(κ(T−t))sinh⁡(κT).x(t) = X\,\frac{\sinh\left(\kappa(T - t)\right)}{\sinh(\kappa T)}.
  • κ\kappa is urgency, in units of 1/time; 1/κ1/\kappa is the time scale over which the position decays. Everything depends on the single number κT\kappa T.
  • κ→0\kappa \to 0 (risk-neutral, or tiny volatility, or very expensive impact) gives x(t)=X(1−t/T)x(t) = X(1 - t/T): TWAP, constant-rate selling.
  • Large κT\kappa T gives roughly exponential decay Xe−κtX e^{-\kappa t}: sell most of it early.
  • A handy check: the fraction still held at the halfway point is sinh⁡(κT/2)/sinh⁡(κT)=1/(2cosh⁡(κT/2))\sinh(\kappa T/2)/\sinh(\kappa T) = 1/(2\cosh(\kappa T/2)), which is 12\tfrac12 for TWAP and falls as urgency rises.

The closed forms for the schedule's cost and risk (excluding the fixed permanent term) are

E[C]−12γX2=ηX2κsinh⁡2(κT)(sinh⁡(2κT)4+κT2),Var⁡[C]=σ2X2sinh⁡2(κT)(sinh⁡(2κT)4κ−T2),\mathbb{E}[C] - \tfrac12\gamma X^2 = \frac{\eta X^2\kappa}{\sinh^2(\kappa T)}\left(\frac{\sinh(2\kappa T)}{4} + \frac{\kappa T}{2}\right), \quad \operatorname{Var}[C] = \frac{\sigma^2X^2}{\sinh^2(\kappa T)}\left(\frac{\sinh(2\kappa T)}{4\kappa} - \frac{T}{2}\right),

which reduce to ηX2/T\eta X^2/T and σ2X2T/3\sigma^2X^2T/3 for TWAP. Tracing λ\lambda from 0 upwards gives the efficient frontier of execution: the lowest expected cost for each level of risk.

The original paper works in discrete time with NN trades; the schedule has the same sinh form with a slightly adjusted κ\kappa, and converges to this one as the intervals shrink.

Worked example

liquidating a million shares in a day

Sell X=1,000,000X = 1{,}000{,}000 shares of a 50-dollar stock over T=1T = 1 day. Daily volatility is 2%, so σ=1\sigma = 1 dollar per share per day\sqrt{\text{day}}. Temporary impact is η=10−7\eta = 10^{-7} dollars per share per (share per day), so selling at a million shares a day costs 10 cents a share. Compute cost, risk and the schedule for κT=0\kappa T = 0, 1, 2 and 4, and find the risk aversion that gives each.

Show solution

TWAP (κ=0\kappa = 0): expected temporary cost ηX2/T=10−7×1012=\eta X^2/T = 10^{-7} \times 10^{12} = $100,000 (20 bps on $50m). Risk: σ2X2T/3=106/3≈\sqrt{\sigma^2X^2T/3} = 10^6/\sqrt3 \approx $577,000 standard deviation. Note the imbalance: the risk is almost six times the expected cost, which is why risk-averse desks front-load.

Urgency. λ=κ2η/σ2\lambda = \kappa^2\eta/\sigma^2, so κT=1,2,4\kappa T = 1, 2, 4 correspond to λ=10−7\lambda = 10^{-7}, 4×10−74 \times 10^{-7} and 1.6×10−61.6 \times 10^{-6} per dollar.

import math

def ac_schedule(X, T, sigma, eta, risk_aversion, n_steps=10):
    """Almgren-Chriss (continuous time, linear temporary impact): holdings path, expected cost, cost st. dev."""
    kappa = math.sqrt(risk_aversion * sigma**2 / eta)
    if kappa == 0:
        hold = lambda t: X * (1 - t / T)
        cost = eta * X**2 / T
        var = sigma**2 * X**2 * T / 3
    else:
        s = math.sinh(kappa * T)
        hold = lambda t: X * math.sinh(kappa * (T - t)) / s
        cost = eta * X**2 * kappa * (math.sinh(2 * kappa * T) / 4 + kappa * T / 2) / s**2
        var = sigma**2 * X**2 * (math.sinh(2 * kappa * T) / (4 * kappa) - T / 2) / s**2
    path = [hold(T * k / n_steps) for k in range(n_steps + 1)]
    return kappa, path, cost, math.sqrt(var)

X, T, sigma, eta = 1_000_000, 1.0, 1.0, 1e-7
for kT in (0, 1, 2, 4):
    lam = (kT / T) ** 2 * eta / sigma**2
    kappa, path, cost, sd = ac_schedule(X, T, sigma, eta, lam)
    held = [round(p / X, 2) for p in path[::2]]
    print(f"kappa*T={kT}  lambda={lam:.1e}  cost={cost:,.0f}  sd={sd:,.0f}  held at t=0,.2,..,1: {held}")

Output:

kappa*T=0  lambda=0.0e+00  cost=100,000  sd=577,350  held at t=0,.2,..,1: [1.0, 0.8, 0.6, 0.4, 0.2, 0.0]
kappa*T=1  lambda=1.0e-07  cost=101,855  sd=542,666  held at t=0,.2,..,1: [1.0, 0.76, 0.54, 0.35, 0.17, 0.0]
kappa*T=2  lambda=4.0e-07  cost=118,936  sd=470,444  held at t=0,.2,..,1: [1.0, 0.65, 0.42, 0.24, 0.11, 0.0]
kappa*T=4  lambda=1.6e-06  cost=201,208  sd=352,722  held at t=0,.2,..,1: [1.0, 0.45, 0.2, 0.09, 0.03, 0.0]

(A direct numerical integration of ηx˙2\eta\dot{x}^2 and σ2x2\sigma^2x^2 along each path reproduces these figures.)

Reading the frontier. At κT=2\kappa T = 2 the desk sells 35% of the order in the first fifth of the day instead of 20%, paying about $19,000 more in expected impact to cut the standard deviation by about $107,000. At κT=4\kappa T = 4 it sells 55% in the first fifth and doubles the expected cost. Near TWAP the frontier is flat: the first bit of front-loading reduces risk almost for free (κT=1\kappa T = 1 costs $1,855 more for $35,000 less standard deviation). That is the general shape: at the risk-neutral optimum, the marginal cost of reducing variance is zero.

Midpoint check for κT=2\kappa T = 2: 1/(2cosh⁡1)≈0.3241/(2\cosh 1) \approx 0.324 of the order is still held at noon, against 0.5 for TWAP.

What moves the schedule

  • Higher volatility or higher risk aversion: κ\kappa rises, trade faster.
  • Higher temporary impact (illiquid name, wide spread): κ\kappa falls, trade more evenly.
  • Longer horizon: TWAP's impact cost ηX2/T\eta X^2/T falls as 1/T1/T but its variance σ2X2T/3\sigma^2X^2T/3 grows with TT. Picking the horizon is itself a cost-risk decision.
  • Alpha: if you expect the price to drift against you (you are selling and expect it to fall, or your signal decays), add a drift term and the optimum front-loads even when risk-neutral. If it drifts in your favour, back-load.

The linear-impact assumption is what makes the solution clean. Empirically impact is concave in size (the square-root law); with power-law temporary impact ηv1+ϕ\eta v^{1+\phi} the Euler–Lagrange equation is nonlinear, but the qualitative trade-off is unchanged.

VWAP: optimal when impact depends on participation

Volume is not flat through the day: in most equity markets it is high at the open, low at midday and highest into the close. Impact depends on how large you are relative to the market, so a more realistic temporary cost uses the participation rate: per-share cost η v(t)/V(t)\eta\,v(t)/V(t), where V(t)V(t) is market volume rate. For a risk-neutral trader:

min⁡v∫0Tη v(t)2V(t) dtsubject to∫0Tv(t) dt=X.\min_{v}\int_0^T \eta\,\frac{v(t)^2}{V(t)}\,dt \quad \text{subject to} \quad \int_0^T v(t)\,dt = X.

The Lagrangian's first-order condition is 2ηv(t)/V(t)=constant2\eta v(t)/V(t) = \text{constant}, so v(t)∝V(t)v(t) \propto V(t): trade in proportion to market volume, which is the VWAP schedule, at a constant participation rate. TWAP is the special case of flat volume. In practice VWAP algorithms trade to a forecast volume curve; risk aversion and alpha tilt the schedule away from it in the same way as above.

Worked example

TWAP against VWAP on a U-shaped day

Split the day into four buckets with market volume shares 40%, 20%, 15% and 25%. Temporary cost in bucket ii is proportional to xi2/Vix_i^2/V_i, where xix_i is the amount you trade in it. How much more does TWAP cost than VWAP?

Show solution

VWAP: xi=XVix_i = XV_i, so the cost is ∑iX2Vi2/Vi=X2∑iVi=X2\sum_i X^2V_i^2/V_i = X^2\sum_i V_i = X^2.

TWAP: xi=X/4x_i = X/4, so the cost is X216∑i1Vi=X216(2.5+5+6.67+4)=18.1716X2≈1.135X2\frac{X^2}{16}\sum_i \frac{1}{V_i} = \frac{X^2}{16}(2.5 + 5 + 6.67 + 4) = \frac{18.17}{16}X^2 \approx 1.135X^2.

TWAP is about 13.5% more expensive, almost all from trading a quarter of the order in the 15% midday bucket, where it is a much larger share of the market. By Cauchy–Schwarz, ∑1/Vi≥16\sum 1/V_i \ge 16 whenever four shares sum to one, with equality only for flat volume, so TWAP can never beat VWAP under this cost model.

Implementation shortfall and benchmarks

The Almgren–Chriss cost is implementation shortfall: the difference between the paper portfolio traded at the arrival (decision) price and what you actually achieved. A full decomposition (Perold) separates:

  • delay cost: the price move between the decision and the start of execution;
  • execution cost: impact and spread on the shares traded, plus drift during execution;
  • opportunity cost: the move on shares you never traded;
  • fees and commissions.

Execution desks are measured against a benchmark, and the benchmark shapes behaviour:

  • Arrival price (IS) rewards balancing impact against risk and against alpha decay; it is what a portfolio manager actually experiences.
  • VWAP rewards matching the volume curve. It is easy to achieve and hard to game against, but it hides cost: if your own order is a large share of the day's volume, it moves the VWAP itself, and on a trending day you can "beat VWAP" while paying a large shortfall.
  • Close suits index funds that are marked at the close and drives volume into the closing auction.

How this comes up in interviews

  • "Derive the optimal liquidation schedule." Write expected cost and variance, form the mean-variance objective, get x¨=κ2x\ddot{x} = \kappa^2x, apply the boundary conditions. Then interpret κ\kappa and the two limits.
  • "Why does a risk-averse trader front-load?" Variance accrues on inventory held; selling early cuts it, at the price of a faster (more expensive) rate.
  • "When is VWAP optimal?" When temporary impact depends on participation rate and you are risk-neutral with no alpha.
  • "Your algo beat VWAP by 5 bps but the PM is unhappy. Why?" The price fell all day while you sold; your shortfall against arrival was large, and possibly your own selling drove the VWAP.

Knowledge check

An Almgren–Chriss schedule has κT=2\kappa T = 2. What fraction of the order is still held at t=T/2t = T/2?

Knowledge check

A risk-neutral trader executes by TWAP and doubles the horizon. What happens to the expected temporary impact cost and to the variance of the cost?

Knowledge check

Which change makes the Almgren–Chriss optimal schedule closer to TWAP?

Knowledge check

Temporary impact per share is proportional to your trading rate divided by market volume. You are risk-neutral with no view on price. Which schedule minimises expected cost?

Key takeaways

  • Almgren–Chriss: minimise η∫x˙2+λσ2∫x2\eta\int\dot{x}^2 + \lambda\sigma^2\int x^2; the solution is x(t)=Xsinh⁡(κ(T−t))/sinh⁡(κT)x(t) = X\sinh(\kappa(T-t))/\sinh(\kappa T) with urgency κ=λσ2/η\kappa = \sqrt{\lambda\sigma^2/\eta}.
  • κ→0\kappa \to 0 gives TWAP (cost ηX2/T\eta X^2/T, variance σ2X2T/3\sigma^2X^2T/3); larger κT\kappa T front-loads. Permanent impact 12γX2\tfrac12\gamma X^2 does not depend on the schedule.
  • Near TWAP, reducing risk is almost free; far from it, it is expensive. Trace the efficient frontier, do not pick one point blindly.
  • With participation-based impact, the risk-neutral optimum is VWAP.
  • Implementation shortfall against arrival price is the cost that matters; VWAP benchmarks can hide it.

Finished reading?

Answer the 4 knowledge checks to complete this lesson (0 done).