Hawkes Processes for Order Flow

Order flow clusters. A buy market order makes another buy more likely soon after; cancelations often arrive in bursts; a price move can trigger both aggressive flow and quote replenishment. Independent Poisson arrivals cannot represent this behavior. Hawkes processes model it with intensities that increase after events and decay over time, making them a useful bridge between descriptive event data and executable microstructure models.

For event types \(i=1,\ldots,d\), a linear multivariate Hawkes intensity is

\[ \lambdai(t)=\mui+\sum{j=1}^d\sum{t^jk<t} \alpha{ij}\exp[-\beta{ij}(t-t^jk)]. \]

The baseline \(\mu_i\) is exogenous activity. Each past event of type \(j\) raises—or, in generalized models can inhibit—the near-term intensity of type \(i\). This lets trades, adds, cancelations, and price moves interact in event time.

Designing the event taxonomy

An overbroad taxonomy loses economic structure, while a high-dimensional one creates parameters that cannot be estimated reliably. Begin with trade sign and best-queue events, then add categories only if they improve an out-of-sample decision.

Event typeExampleUseful excitation question
Buy market orderTrade lifts askDoes it trigger more buys?
Sell market orderTrade hits bidDoes it trigger bid cancelations?
Ask cancelationBest ask size removedDoes it precede upward price moves?
Bid addNew best-bid liquidityDoes it mean-revert sell pressure?
Midprice moveOne-tick revisionDoes it cause follow-through flow?

Label events in exchange sequence order, with a clearly defined venue scope. Mixing consolidated trades with a single venue's quote updates creates artificial lead-lag structure. Book state and event normalization need the discipline described in market microstructure.

Branching interpretation and stability

For an exponential kernel, the integral \(\alpha{ij}/\beta{ij}\) is the expected number of direct type-\(i\) offspring from a type-\(j\) parent. The matrix of these integrals is the branching matrix \(K\). A stationary linear Hawkes process requires its spectral radius to be below one:

\[ \rho(K)<1. \]

The endogenous fraction is often summarized in a univariate model as \(\alpha/\beta\). A high value means much activity is internally propagated rather than explained by the baseline. It does not prove that traders are irrational or that the system is about to destabilize; unobserved common news can also appear as mutual excitation.

import numpy as np

def exponential_intensity(t, history, mu, alpha, beta):
    age = t - np.asarray(history)
    return mu + alpha * np.exp(-beta * age[age > 0]).sum()

def branching_ratio(alpha, beta):
    return alpha / beta

For multivariate estimation, use a tested library or a constrained optimizer with nonnegative kernels and explicit stability checks. A short code snippet is not a production calibrator: likelihood gradients, observation boundaries, and numerical overflow matter materially.

Fitting without fooling yourself

The log likelihood includes each observed event's log intensity minus the integrated intensity over the sample. Include market open/close, halts, auctions, and feed gaps in the observation window. Treating a lunch break as zero event intensity makes the decay parameter absorb session boundaries.

Intraday seasonality is particularly important. A constant baseline interprets the predictable opening surge as self-excitation. Use a piecewise or smooth time-of-day baseline, and fit per liquidity regime where feasible. Test on later days, not randomly held-out events from the same burst.

CheckGood signFailure interpretation
Time-rescaling residualsApproximately unit exponentialMisspecified intensity
Simulated event countsMatch mean and dispersionMissing clustering
Sign autocorrelationSimilar decay profileIncorrect cross-kernels
Branching radiusSafely below oneUnstable fitted process
Out-of-sample log scoreBeats seasonal Poisson baselineNo useful dependence

Hawkes features for execution

The intensity itself can be a causal state feature. A burst of sell-market-order intensity accompanied by ask cancelations may increase the expected cost of a buy order. A buy program should not simply chase a rising buy intensity, however: doing so may join the same feedback loop and amplify footprint.

Combine intensities with order-flow imbalance signals, spread, and depth to predict short-horizon markouts or fill risk. For passive quoting, the valuable target is signed post-fill return. For aggressive execution, it is the distribution of cost conditional on waiting versus trading now.

Hawkes models are not full order-book simulators. They know an event was a cancellation, but not necessarily where it sat in the queue or how it affects your rank. Integrate them with a queue-aware model when simulating fills.

Key takeaways

  • Hawkes processes represent clustered order flow through intensities excited by past events.
  • Event definitions, venue consistency, and intraday baselines are more consequential than kernel sophistication.
  • The branching matrix must be stable; a large endogenous fraction is not evidence of trader intent.
  • Validate through time-rescaling, simulation, and forward-day likelihood, not in-sample fit alone.
  • Use conditional intensities as execution-risk features alongside book state and post-fill markouts.
#Hawkes process #order flow #point process #market microstructure #Python