What does Order Books, Hawkes Processes and Toxic Flow conclude, in numbers, about “How to Split a Large Order: Almgren–Chriss Optimal Execution”?
Answer: Under linear impact and a mean–variance criterion, the Almgren–Chriss model gives a hyperbolic-sine optimal trajectory; the risk aversion \(\lambda\) slides between expected cost and variance, tracing the efficient frontier, with TWAP and aggressive execution at its two ends. In the program, Monte Carlo agrees with the formulas. VWAP is the risk-neutral optimum only when temporary impact is inversely proportional to volume; with constant impact it costs 5.3 % more than TWAP. Iceberg orders are a question of how orders are displayed, handled in a separate layer from the splitting schedule. Linear impact is a convenient approximation; the empirical impact of metaorders is close to a square-root law (Book 39).
Scope of the numbers: Why does a market maker quote a spread? Why do orders arrive in clusters? Can "toxic" order flow be measured from trade data? This book presents mathematical models for teaching and research and is not investment or trading advice. Marked boxes separate published evidence, runnable Python calculations (16 programs), classical sources and the author's models and hypotheses; all data in the book are fictional or simulated.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python only
| strategy E[shortfall] $ sd $ | 1/kappa (days) |
| TWAP (lam | 0) 685,000 1,208,032 - |
| lam | 1e-7 692,710 1,139,533 5.25 |
| lam | 1e-6 961,940 828,686 1.66 |
| lam | 1e-5 2,545,884 441,579 0.53 |
| lam | 1e-4 7,360,846 199,051 0.17 |
| everything in slice 1 | 25,062,500 0 |
| Monte Carlo, lam | 1e-6, 20,000 paths: mean 956,607 (961,940), sd 830,322 (828,686) |
| constant eta: TWAP E 685,000 sd 1,208,032; VWAP E 720,976 sd 1,207,900 | |
| eta inversely prop. to volume: TWAP E 718,634 sd 1,208,032; VWAP E 685,000 sd 1,207,900 |
Key formula
Show the full program
# Almgren-Chriss (2001) optimal liquidation of X shares in N periods of length tau with
# linear permanent impact g(v) = gam v and temporary impact h(v) = eps sgn(v) + eta v.
# Optimal holdings x_k = X sinh(kap (T - t_k)) / sinh(kap T), where
# (2 / tau^2) (cosh(kap tau) - 1) = lam sig^2 / eta_t,
# eta_t = eta (1 - gam tau / (2 eta)).
# Expected shortfall E = gam X^2 / 2 + eps X + (eta_t / tau) sum n_k^2,
# variance V = sig^2 tau sum x_k^2. Parameters are ILLUSTRATIVE (a $50 stock, 1,000,000
# shares over 5 days in 50 slices); lam is the risk aversion (per $).
import math, random, statistics
X, S0, SIG, T, N = 1_000_000, 50.0, 0.95, 5.0, 50
GAM, ETA, EPS = 2.5e-7, 2.5e-6, 0.0625
TAU = T / N; ETAT = ETA * (1 - GAM * TAU / (2 * ETA))
def traj(lam):
if lam == 0:
return [X * (1 - k / N) for k in range(N + 1)]
kap = math.acosh(1 + lam * SIG ** 2 / ETAT * TAU ** 2 / 2) / TAU
return [X * math.sinh(kap * (T - k * TAU)) / math.sinh(kap * T) for k in range(N + 1)]
def cost(x, eta_k=None):
n = [a - b for a, b in zip(x, x[1:])]
eta_k = eta_k or [ETAT] * N
E = GAM * X ** 2 / 2 + EPS * X + sum(e / TAU * v * v for e, v in zip(eta_k, n))
V = SIG ** 2 * TAU * sum(v * v for v in x[1:])
return E, V
def simulate(x, rng, paths=20_000):
n = [a - b for a, b in zip(x, x[1:])]; out = []
for _ in range(paths):
S, cash = S0, 0.0
for v in n: # slice k sells at S_{k-1} - h
cash += v * (S - EPS - ETA * v / TAU)
S += SIG * math.sqrt(TAU) * rng.gauss(0, 1) - GAM * v
out.append(X * S0 - cash) # implementation shortfall
return out
if __name__ == "__main__":
print("strategy E[shortfall] $ sd $ 1/kappa (days)")
for name, lam in (("TWAP (lam = 0)", 0), ("lam = 1e-7", 1e-7), ("lam = 1e-6", 1e-6),
("lam = 1e-5", 1e-5), ("lam = 1e-4", 1e-4)):
x = traj(lam); E, V = cost(x)
kap = (math.acosh(1 + lam * SIG ** 2 / ETAT * TAU ** 2 / 2) / TAU) if lam else 0
hl = f"{1 / kap:8.2f}" if lam else " -"
print(f" {name:24s} {E:12,.0f} {math.sqrt(V):9,.0f} {hl}")
E1 = GAM * X ** 2 / 2 + EPS * X + ETAT / TAU * X ** 2
print(f" {'everything in slice 1':24s} {E1:12,.0f} {0:9,.0f}")
rng = random.Random(2001); x = traj(1e-6); E, V = cost(x); sim = simulate(x, rng)
print(f"Monte Carlo, lam = 1e-6, 20,000 paths: mean {statistics.fmean(sim):,.0f}"
f" ({E:,.0f}), sd {statistics.stdev(sim):,.0f} ({math.sqrt(V):,.0f})")
u = [1.6, 1.2, 1.0, 0.85, 0.8, 0.8, 0.85, 1.0, 1.3, 1.6] # intraday U-shape
vol = [u[k % 10] for k in range(N)]; vbar = statistics.fmean(vol)
xv = [X]
for v in vol:
xv.append(xv[-1] - X * v / sum(vol))
xv[-1] = 0.0
eta_v = [ETAT * vbar / v for v in vol] # thinner book in quiet periods
for lab, ek in (("constant eta", None), ("eta inversely prop. to volume", eta_v)):
Et, Vt = cost(traj(0), ek); Ev, Vv = cost(xv, ek)
print(f"{lab}: TWAP E {Et:,.0f} sd {math.sqrt(Vt):,.0f};"
f" VWAP E {Ev:,.0f} sd {math.sqrt(Vv):,.0f}")Single source and citation
Fan, Y. (2026). High-Frequency Limit Order Book Microstructure, Hawkes Self-Exciting Point Processes and Adverse-Selection Flow Toxicity (Version 1.0.0), Chapter 6: How to Split a Large Order: Almgren–Chriss Optimal Execution. 5D Library. https://doi.org/10.5281/zenodo.23828065
DOI: 10.5281/zenodo.23828065 · Read the monograph · 5DL-B-045 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026045,
author = {Fan, Yafu},
title = {High-Frequency Limit Order Book Microstructure, Hawkes Self-Exciting Point Processes and Adverse-Selection Flow Toxicity},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.23828065},
url = {https://doi.org/10.5281/zenodo.23828065}
}Other chapter answers in this book
- Chapter 1 · Information Asymmetry and the Bid–Ask Spread: Glosten–Milgrom and Kyle
- Chapter 2 · Inventory Risk and Optimal Market Making: the Avellaneda–Stoikov Equations
- Chapter 3 · Why Orders Arrive in Clusters: Hawkes Processes, the Signature Plot and the Epps Effect
- Chapter 4 · Measuring Toxicity: the Probability of Informed Trading, VPIN and the Flash-Crash Dispute
- Chapter 5 · Book Imbalance and Queues: Order Flow Imbalance, Queue Imbalance and Queue Position
- Chapter 7 · Reading the Classics: the Market Director, the Conspicuous Mound and the Market Exchange
- Chapter 8 · Practice and a Pre-Registered Test