What does Order Books, Hawkes Processes and Toxic Flow conclude, in numbers, about “Why Orders Arrive in Clusters: Hawkes Processes, the Signature Plot and the Epps Effect”?
Answer: Hawkes processes describe order clustering by letting past events raise the current intensity; the branching representation gives the mean intensity \(\mu/(1-\eta)\), the cluster size \(1/(1-\eta)\) and the long-window Fano factor \(1/(1-\eta)^2\), and stationarity requires \(\eta = \alpha/\beta < 1\), as the framework states. Time-rescaling tests distinguish Poisson and Hawkes models clearly. Whether real markets have a branching ratio near 1 remains disputed (recapped from Book 39). Mutually exciting processes reproduce both the signature plot and the Epps effect; but the Epps effect can also come entirely from asynchronous trading, in which case the Hayashi–Yoshida estimator removes it. "Hawkes processes as the explanation of the Epps effect" in the author's framework should be qualified to "Hawkes processes as one explanation".
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
| mu 0.5, beta 1.0, T 40,000 rate cluster size Fano (W | 200) |
| eta simulated theory simulated theory simulated theory | |
| 0.3 | 0.713 0.714 1.43 1.43 1.90 2.04 |
| 0.6 | 1.270 1.250 2.51 2.50 5.88 6.25 |
| 0.8 | 2.529 2.500 5.04 5.00 22.24 25.00 |
| 0.9 | 5.102 5.000 10.19 10.00 97.05 100.00 |
| MLE on T | 5,000 (12292 events; truth mu 0.5, alpha 0.8, beta 1.0): |
| mu 0.489, alpha 0.811, beta 1.013, branching ratio 0.801 | |
| time-rescaling check (KS distance to Exp(1); 5 % critical value 0.012): | |
| Poisson fit 0.163 Hawkes fit 0.006 |
Key formula
Show the full program
# Exponential Hawkes process lambda(t) = mu + sum_{t_i < t} alpha exp(-beta (t - t_i)),
# simulated through its cluster (branching) representation (Hawkes & Oakes 1974):
# immigrants arrive as Poisson(mu); every event has Poisson(eta) children
# (eta = alpha/beta), each after an Exp(beta) delay. Checks: mean rate mu/(1 - eta),
# cluster size 1/(1 - eta), Fano factor of counts in long windows -> 1/(1 - eta)^2;
# maximum likelihood; and a time-rescaling (residual) check of a Poisson fit against
# a Hawkes fit.
import math, random, statistics
def poisson(rng, m):
k, p, L = 0, rng.random(), math.exp(-m)
while p > L:
k += 1; p *= rng.random()
return k
def simulate(rng, mu, eta, beta, T):
ev, sizes, t = [], [], rng.expovariate(mu)
while t < T:
cluster, gen = [t], [t]
while gen:
nxt = []
for s in gen:
for _ in range(poisson(rng, eta)):
c = s + rng.expovariate(beta)
if c < T:
nxt.append(c)
cluster += nxt; gen = nxt
ev += cluster; sizes.append(len(cluster)); t += rng.expovariate(mu)
return sorted(ev), sizes
def loglik(th, ev, T):
mu, alpha, beta = th
if min(th) <= 0 or alpha >= beta:
return -1e18
ll, r, prev = 0.0, 0.0, None
for t in ev: # r = sum of exp(-beta (t - t_j)), t_j < t
if prev is not None:
r = (r + 1) * math.exp(-beta * (t - prev))
ll += math.log(mu + alpha * r); prev = t
comp = mu * T + alpha / beta * sum(1 - math.exp(-beta * (T - t)) for t in ev)
return ll - comp
def nelder_mead(f, x0, it=400):
n = len(x0)
pts = [list(x0)] + [[x * (1.3 if i == j else 1) for j, x in enumerate(x0)]
for i in range(n)]
for _ in range(it):
pts.sort(key=f); c = [sum(p[i] for p in pts[:-1]) / n for i in range(n)]
w = pts[-1]; r = [c[i] + (c[i] - w[i]) for i in range(n)]
if f(r) < f(pts[0]):
e = [c[i] + 2 * (c[i] - w[i]) for i in range(n)]
pts[-1] = e if f(e) < f(r) else r
elif f(r) < f(pts[-2]):
pts[-1] = r
else:
k = [c[i] + 0.5 * (w[i] - c[i]) for i in range(n)]
if f(k) < f(w):
pts[-1] = k
else:
pts = [pts[0]] + [[pts[0][i] + 0.5 * (p[i] - pts[0][i]) for i in range(n)]
for p in pts[1:]]
return min(pts, key=f)
def ks_exp(x): # KS distance to Exp(1)
x = sorted(x); n = len(x)
return max(max((i + 1) / n - (1 - math.exp(-v)), (1 - math.exp(-v)) - i / n)
for i, v in enumerate(x))
def rescaled(ev, mu, alpha, beta):
out, r, prev, Lprev = [], 0.0, None, 0.0
for t in ev: # compensator increments between events
if prev is None:
L = mu * t
else:
dec = 1 - math.exp(-beta * (t - prev))
L = Lprev + mu * (t - prev) + alpha / beta * (r + 1) * dec
r = (r + 1) * math.exp(-beta * (t - prev))
if prev is not None:
out.append(L - Lprev)
Lprev, prev = L, t
return out
if __name__ == "__main__":
rng = random.Random(1971); mu, beta, T, W = 0.5, 1.0, 40_000.0, 200.0
print("mu 0.5, beta 1.0, T 40,000 rate cluster size Fano (W=200)")
print(" eta simulated theory simulated theory simulated theory")
for eta in (0.3, 0.6, 0.8, 0.9):
ev, sz = simulate(rng, mu, eta, beta, T)
cnt = [0] * int(T / W)
for t in ev:
cnt[int(t / W)] += 1
fano = statistics.variance(cnt) / statistics.fmean(cnt)
print(f" {eta:.1f} {len(ev) / T:7.3f} {mu / (1 - eta):6.3f}"
f" {statistics.fmean(sz):7.2f} {1 / (1 - eta):5.2f}"
f" {fano:8.2f} {1 / (1 - eta) ** 2:6.2f}")
ev, _ = simulate(rng, 0.5, 0.8, 1.0, 5000.0)
th = nelder_mead(lambda p: -loglik(p, ev, 5000.0), [0.3, 0.3, 0.6])
print(f"MLE on T = 5,000 ({len(ev)} events; truth mu 0.5, alpha 0.8, beta 1.0):")
print(f" mu {th[0]:.3f}, alpha {th[1]:.3f}, beta {th[2]:.3f},"
f" branching ratio {th[1] / th[2]:.3f}")
lam = len(ev) / 5000.0
gaps = [lam * (b - a) for a, b in zip(ev, ev[1:])]
print(f"time-rescaling check (KS distance to Exp(1); 5 % critical value"
f" {1.358 / math.sqrt(len(gaps)):.3f}):")
ks_h = ks_exp(rescaled(ev, *th))
print(f" Poisson fit {ks_exp(gaps):.3f} Hawkes fit {ks_h:.3f}")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 3: Why Orders Arrive in Clusters: Hawkes Processes, the Signature Plot and the Epps Effect. 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 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 6 · How to Split a Large Order: Almgren–Chriss Optimal Execution
- Chapter 7 · Reading the Classics: the Market Director, the Conspicuous Mound and the Market Exchange
- Chapter 8 · Practice and a Pre-Registered Test