Quant techniques · optimal execution

Selling a big order: the Almgren–Chriss trade-off

A fund needs to sell a million shares by the close. Dump them all at once and the price collapses under the order. Spread them evenly over the day and the price can drift a long way before you finish. Almgren and Chriss (2000) wrote this down as a trade-off between expected cost and risk, and the optimal schedule turns out to be a hyperbolic sine.

1cost=η ⁣∫0Tvt2 dt⏟impact  −  σ ⁣∫0Txt dWt⏟price risk\text{cost} = \underbrace{\eta\!\int_0^T v_t^2\,dt}_{\text{impact}} \;-\; \underbrace{\sigma\!\int_0^T x_t\,dW_t}_{\text{price risk}} x(t): shares still held. v = −ẋ: selling rate. Temporary impact costs η per unit of rate, per share. Unsold shares are exposed to price moves.
2min⁡x  E[cost]+λ Var[cost]=∫0T(η x˙2+λσ2x2)dt\min_x\; E[\text{cost}] + \lambda\,\mathrm{Var}[\text{cost}] = \int_0^T \left(\eta\,\dot x^2 + \lambda\sigma^2 x^2\right) dt Mean–variance with risk aversion λ. A calculus-of-variations problem.
3x¨=κ2x,κ=λσ2/η\ddot x = \kappa^2 x, \qquad \kappa = \sqrt{\lambda\sigma^2/\eta} The Euler–Lagrange equation. κ measures urgency: risk-aversion times volatility, over the cost of impact.
4x(t)=X sinh⁡(κ(T−t))sinh⁡(κT)x(t) = X\,\dfrac{\sinh\big(\kappa(T - t)\big)}{\sinh(\kappa T)} With x(0) = X and x(T) = 0. As κ → 0 this is a straight line (TWAP). For large κ it decays like e^(−κt).
The model

Two costs pulling in opposite directions

Let x(t) be the shares you still hold, starting at X and ending at 0 at time T, and let v=−x˙v = -\dot x be how fast you sell. Two things cost you money.

Market impact. Selling fast pushes the price down while you trade. The simplest model says the price you get is lower than the market price by ηv\eta v, linear in your trading rate. Over a short interval you sell v dtv\,dt shares at that discount, so the impact cost is ηv2 dt\eta v^2\,dt. Because it’s quadratic in v, it pays to spread trading out: selling twice as fast for half as long doubles the cost.

Price risk. While you hold x shares, the price moves by σ dW\sigma\,dW, so your proceeds move by x σ dWx\,\sigma\,dW. That has mean zero but variance σ2x2 dt\sigma^2 x^2\,dt. The longer you hold inventory, the more uncertain the final proceeds.

Putting them together, the expected cost and variance of a schedule are

E[cost]=η∫0Tx˙2 dt,Var[cost]=σ2∫0Tx2 dtE[\text{cost}] = \eta\int_0^T \dot x^2\,dt, \qquad \mathrm{Var}[\text{cost}] = \sigma^2\int_0^T x^2\,dt

Selling evenly (TWAP, x=X(1−t/T)x = X(1 - t/T)) gives the smallest possible expected cost, ηX2/T\eta X^2/T, but variance σ2X2T/3\sigma^2 X^2 T/3. Selling everything immediately has no risk but infinite impact in this model. Everything else lies in between.

A permanent impact term (each share sold moves the price down permanently by γ per share) adds 12γX2\tfrac12\gamma X^2 to the cost whatever the schedule is, as long as it’s linear. So it doesn’t change the optimal schedule, and it’s left out here.

Solving it

The calculus of variations gives a sinh

Minimise E+λ VarE + \lambda\,\mathrm{Var}, which is the integral of the “Lagrangian” L=ηx˙2+λσ2x2\mathcal L = \eta\dot x^2 + \lambda\sigma^2 x^2. The Euler–Lagrange equation ddt ∂L/∂x˙=∂L/∂x\tfrac{d}{dt}\,\partial\mathcal L/\partial\dot x = \partial \mathcal L/\partial x gives

2η x¨=2λσ2x⟹x¨=κ2x2\eta\,\ddot x = 2\lambda\sigma^2 x \quad\Longrightarrow\quad \ddot x = \kappa^2 x

The general solution is Aeκt+Be−κtA e^{\kappa t} + B e^{-\kappa t}. Fitting x(0) = X and x(T) = 0 gives step 4. The answer depends on the parameters only through κT, a dimensionless urgency number:

  • κT ≈ 0 (risk-neutral, or impact very expensive): a straight line, TWAP.
  • κT around 1–3: front-loaded. Sell faster early, while there’s lots of inventory at risk, and slow down as the risk shrinks.
  • κT large: x≈Xe−κtx \approx X e^{-\kappa t}. Inventory decays exponentially with half-life ln⁡2/κ\ln 2/\kappa, and the deadline barely matters.
urgency κT

Shares still to sell, x(t) / X

Efficient frontier: expected cost vs risk

TWAP: sell at a constant rateoptimal schedule at this urgency
–expected impact cost (× TWAP)
–s.d. of cost from price moves (× TWAP)
–time to sell the first half (fraction of T)

The frontier on the right is every schedule you could choose, traced out as κT goes from 0 to 8. Starting from TWAP (grey dot), a little urgency buys a lot of risk reduction for very little cost: at κT = 1, risk drops 6% for a 2% increase in cost. Further along, each unit of risk costs more. At κT = 3 you pay 55% more impact to cut the risk by 30%. Which point is best depends on λ, and nothing else.

import numpy as np

def ac_schedule(X, T, sigma, eta, lam, n=100):
    """Almgren–Chriss optimal liquidation. Returns times, holdings, expected cost, s.d. of cost."""
    kappa = np.sqrt(lam * sigma**2 / eta)
    t = np.linspace(0, T, n + 1)
    if kappa * T < 1e-8:
        x = X * (1 - t / T)                              # TWAP
    else:
        x = X * np.sinh(kappa * (T - t)) / np.sinh(kappa * T)
    dt = T / n
    v = -np.diff(x) / dt                                 # selling rate in each slice
    exp_cost = eta * np.sum(v**2) * dt
    sd_cost = sigma * np.sqrt(np.sum(x[:-1]**2) * dt)
    return t, x, exp_cost, sd_cost
How the knobs move κ

Reading κ = √(λσ²/η)

  • More volatile stock → larger κ → trade faster. Doubling σ doubles κ.
  • More risk-averse trader → larger κ, but only as √λ. Four times the risk aversion doubles the urgency.
  • More expensive impact (illiquid stock, larger η) → smaller κ → spread the order out.
  • Longer horizon → larger κT, so a schedule that was nearly linear over an hour becomes very front-loaded over a week.

For large κT the cost and risk relative to TWAP have simple limits: cost ≈ κT/2 × TWAP, and risk ≈ 3/(2κT)\sqrt{3/(2\kappa T)} × TWAP.

What the simple model leaves out

  • Impact isn’t linear. Empirically, impact grows roughly like the square root of the order size relative to volume. That changes the shape of the optimal schedule, but not the basic trade-off.
  • Volume isn’t flat. Real days have a U-shaped volume profile, so practical schedules trade in proportion to expected volume (VWAP) and tilt from there.
  • Alpha. If you expect the price to fall, you sell faster than the risk alone justifies. A drift term adds a linear piece to the Lagrangian.
  • Static vs adaptive. With mean–variance and this model, the optimal static schedule is close to optimal. With other objectives, updating as prices move can do better.

Where people slip in interviews

  • “TWAP is optimal.” It minimises expected cost, but only for a risk-neutral trader. Any risk aversion front-loads the schedule.
  • Wrong scaling of impact cost. Temporary impact per share is ηv, and you trade v dt shares, so the cost rate is ηv², not ηv.
  • Forgetting the boundary condition. The solution must hit zero exactly at T. That’s what picks sinh over a pure exponential.
  • Thinking permanent impact changes the schedule. With linear permanent impact it adds a constant ½γX², whatever you do.
Practice

Try these before you open the answer

Warm-upShow that TWAP minimises expected impact cost for a fixed T.
Show answer

Minimise ∫0Tx˙2 dt\int_0^T \dot x^2\,dt subject to x(0) = X, x(T) = 0. By Cauchy–Schwarz, (∫0Tx˙ dt)2≤T∫0Tx˙2 dt\left(\int_0^T \dot x\,dt\right)^2 \le T\int_0^T \dot x^2\,dt, so ∫x˙2≥X2/T\int \dot x^2 \ge X^2/T, with equality when x˙\dot x is constant. That is TWAP.

VarianceWhat is the variance of the TWAP cost?
Show answer
σ2∫0TX2(1−tT)2dt=σ2X2T3\sigma^2\int_0^T X^2\left(1 - \tfrac{t}{T}\right)^2 dt = \frac{\sigma^2 X^2 T}{3}
ScalingA trader doubles their risk aversion and the stock's volatility doubles too. What happens to κ?
Show answer

κ∝λ σ\kappa \propto \sqrt{\lambda}\,\sigma, so it goes up by 2×2≈2.83\sqrt2 \times 2 \approx 2.83.

Half-lifeWith κ = 2 per hour and a long horizon, roughly how long does it take to sell the first half of the order?
Show answer

For large κT, x≈Xe−κtx \approx X e^{-\kappa t}, so half is gone after ln⁡2/κ≈0.35\ln 2/\kappa \approx 0.35 hours, about 21 minutes.

ExactWith κT = 2, what fraction of the order is still unsold at the halfway point t = T/2?
Show answer
sinh⁡(1)sinh⁡(2)=1.1753.627≈32%\frac{\sinh(1)}{\sinh(2)} = \frac{1.175}{3.627} \approx 32\%

TWAP would still hold 50%.

Permanent impactEach share sold moves the price down permanently by γ per share. Show that this adds ½γX² to the cost for every schedule.
Show answer

When x shares are left, the price has been pushed down by γ(X − x). Selling the next −dx-dx shares at that depressed price costs γ(X−x)(−dx)\gamma(X - x)(-dx). Integrating from x = X down to 0 gives γ∫0X(X−x) dx=12γX2\gamma\int_0^X (X - x)\,dx = \tfrac12\gamma X^2, which doesn’t depend on the path.

StretchAdd a known downward drift: the price falls at rate μ per unit time. How does the Euler–Lagrange equation change?
Show answer

Holding x shares now loses μx dt\mu x\,dt in expectation, so the Lagrangian gains a term μx\mu x: L=ηx˙2+λσ2x2+μx\mathcal L = \eta\dot x^2 + \lambda\sigma^2 x^2 + \mu x. The equation becomes 2ηx¨=2λσ2x+μ2\eta\ddot x = 2\lambda\sigma^2 x + \mu, so x¨=κ2x+μ/(2η)\ddot x = \kappa^2 x + \mu/(2\eta). The solution is the sinh schedule shifted down by a constant, −μ/(2ηκ2)-\mu/(2\eta\kappa^2), before the boundary conditions are fitted, which sells even faster early on.

The closed-form schedule, cost and risk were checked against a direct numerical optimisation over 100 trading slices.