Skip to content

Ilia DudaCo-op Jan 2027

Order flow that remembers: a Hawkes-driven limit order book

Independent work · September 2026 · synthetic data

A synthetic limit order book driven by a six-kind Hawkes process, simulated exactly in your browser at about 300 events a second and drawn as terrain. Most market orders are set off by earlier ones; Fig. 2 shows what set off any one.


Fig. 1
A simulated order book for a $100.00 stock, second by second: each ridge is the shares waiting at a price.Simulated · Hawkes order flow · six kinds of order · tick $0.01 · not market data
A frame of a synthetic order book, its recent history receding from the front: shares waiting to buy form the left wall, shares waiting to sell the right, and the price runs along the valley between them at $100.19, with a spread of 1 tick · $0.01. 354 trades in the last ten seconds are marked as dots.
Probe
— point at the terrain
Queue
—
When
—

Mid
$100.185
Spread
1 tick · $0.01
Trades, 10 s
354 · 2,152 shares
Events, 10 s
294.1 a second
Stationary rate
300.1 a second
Branching ratio
0.52

Click the terrain, or tab to it and use the arrow keys, to read a price level.

The left wall is shares waiting to buy and the right wall shares waiting to sell; the taller the wall, the more is waiting. The line along the valley floor is the price, and each spark is a trade. Time recedes into the page from now, at the front edge.
The best five price levels on each side at the frame shown, and the shares waiting at each. Mid $100.185, spread 1 tick · $0.01.
BidShares waiting to buyAskShares waiting to sell
$100.1854 shares$100.1922 shares
$100.1787 shares$100.2065 shares
$100.1620 shares$100.2117 shares
$100.1523 shares$100.2223 shares
$100.1480 shares$100.2368 shares

What you are looking at

A limit order book is a market’s list of people waiting to trade. At every price there is a queue: buyers bidding below the last trade, sellers asking above it. The two best prices, the highest bid and the lowest ask, are the touch, and the gap between them is the spread.

In Fig. 1 that list is a landscape. Across the valley runs price, bids to the left and asks to the right; the height of a wall at a price is every share waiting between the touch and that price, so the walls rise away from the spread. Twelve times a simulated second the book is photographed into one ridge, and the ridges recede into the page, the newest at the front, as far back as twenty-one seconds where the device draws them all. The line along the valley floor is the mid-price; each spark is a trade, a market order taking a queue at the touch.

The model

Six kinds of order arrive: limit buys and sells, market buys and sells, and a cancellation on each side. Each arrives as one component of a multivariate Hawkes process, whose intensity is its baseline plus a decaying lift from every earlier event:λi(t) = μi + Σj Σtk < t aij e−βj(t − tk).That is how real order flow behaves: a market buy makes another likelier, liquidity that was taken refills, and a new limit order is often soon cancelled.

The branching matrix Bij = aij/βj counts the events of kind i one event of kind j sets off directly. Its spectral radius, the branching ratio, is 0.52: below one, so the process is stationary, and its long-run rates are (I − B)−1μ, 300.1 events a second in all. Events are drawn exactly, by Ogata’s thinning: between events every intensity only decays, so the intensity now bounds it until the next event, and a candidate drawn at that bound is kept with probability λ(t)/λ*.

Which earlier order set off a given one is never observed, only probable. Just before an order, its intensity is its baseline plus one decaying term for each earlier order; each term’s share of the total is the probability that that order was its parent, and the baseline’s share is the chance it came on its own. Fig. 2 draws the flow the terrain is built from, and reads what set off any order you choose, by the kind of earlier order.

Fig. 2
Ten seconds of the order flow behind Fig. 1: most market orders are set off by earlier ones.Simulated · the market of Fig. 1, a $100.00 stock, at the same moment · six kinds of order · not market data
The order flow in the 10 seconds to Fig. 1's still frame: 162 market buys and 167 market sells, in bursts, among the limit orders and cancellations; market orders arriving at well above the rate they would on their own; and the queues at the best bid and ask, which ran out 29 times.
Order
— point at an order
Set off by
—
On its own
—

Market buys, 10 s
162 · 16.2 a second
Market sells, 10 s
167 · 16.7 a second
Market orders set off, 10 s
61.5%
In theory
62.3%
Queues emptied, 10 s
29

Tap or click an order, or tab to the figure and use the arrow keys, to read what set it off.

Each mark in the six lanes at the top is one order, the newest at the right. Limit orders and cancellations are the grey texture; market orders, the ones that trade, are the solid ticks, and they come in bursts. The middle strip is how fast market sells (above) and market buys (below) are arriving, the intensity λ(t) of the model: the grey band is the rate at which they would arrive on their own, μ, and the indigo beyond it is the part set off by earlier orders, 62.3% of all market buys in the long run. The bottom strip is the shares waiting at the best bid and the best ask; each solid mark is a moment one ran out and the price stepped. Choose any order to see what set it off, by the kind of earlier order, and the chance it came on its own.
The last twenty orders before the still frame, newest first, with what set each one off
Seconds before the still frameOrderPriceSharesSet off by, by kind of earlier orderOn its own
0.008limit sell$100.2534 shareslimit sells 18.7%, market buys 15.8%, cancelled asks 6.9%, market sells 3.2%55.4%
0.010limit buy$100.1715 shareslimit buys 18.1%, market sells 10.3%, cancelled bids 7.1%, market buys 5.6%58.9%
0.012limit buy$100.1440 shareslimit buys 17.5%, market sells 10.4%, cancelled bids 7.2%, market buys 5.7%59.2%
0.013cancelled bid$100.0811 shareslimit buys 34.1%, cancelled bids 10.0%, market sells 5.0%50.9%
0.014limit buy$100.165 shareslimit buys 17.0%, market sells 10.5%, cancelled bids 6.9%, market buys 5.8%59.8%
0.015limit sell$100.4918 shareslimit sells 18.3%, market buys 16.0%, cancelled asks 7.0%, market sells 3.2%55.4%
0.016cancelled ask$100.3612 shareslimit sells 35.4%, cancelled asks 9.6%, market buys 7.7%47.3%
0.028limit buy$100.1839 shareslimit buys 16.9%, market sells 10.7%, cancelled bids 7.2%, market buys 5.9%59.4%
0.028limit sell$100.236 shareslimit sells 18.3%, market buys 16.4%, cancelled asks 6.9%, market sells 3.3%55.2%
0.031limit buy$100.1815 shareslimit buys 16.3%, market sells 10.8%, cancelled bids 7.3%, market buys 5.9%59.6%
0.037cancelled ask$100.298 shareslimit sells 35.8%, cancelled asks 9.6%, market buys 8.0%46.6%
0.041market buy$100.192 sharesmarket buys 48.2%, cancelled asks 17.8%, market sells 4.5%29.6%
0.042limit buy$100.1411 shareslimit buys 16.1%, market sells 11.1%, cancelled bids 7.5%, market buys 5.7%59.6%
0.043market buy$100.1813 sharesmarket buys 46.4%, cancelled asks 18.4%, market sells 4.6%30.5%
0.046limit sell$100.512 shareslimit sells 18.7%, market buys 15.0%, cancelled asks 7.0%, market sells 3.5%55.8%
0.047limit buy$99.9923 shareslimit buys 15.7%, market sells 11.3%, cancelled bids 7.7%, market buys 5.4%60.0%
0.050limit sell$100.184 shareslimit sells 18.3%, market buys 15.2%, cancelled asks 7.1%, market sells 3.5%55.9%
0.052market sell$100.172 sharesmarket sells 34.3%, cancelled bids 22.5%, market buys 7.8%35.4%
0.055cancelled bid$99.712 shareslimit buys 31.6%, cancelled bids 11.1%, market sells 5.0%52.3%
0.057limit buy$100.1721 shareslimit buys 15.6%, market sells 10.4%, cancelled bids 7.6%, market buys 5.6%60.8%

The book

Orders land in a price-level book. A limit order joins a queue at a power-law distance from the touch, or improves the price when the spread is wide; a market order walks the other side level by level, trading at each; a cancellation takes part of one queue, chosen in proportion to its size, which is what keeps the book’s depth stationary instead of growing without bound.

It is calibrated to look like a busy stock opened at $100.00. Measured over ten simulated minutes on the seed Fig. 1 draws: 301.2 events a second, a realised volatility of 26.3% a year (one-second returns of the mid, over 252 trading days of 6.5 hours), and a spread of one or two ticks 99.8% of the time.

One market, in every browser

The server runs the seeded market to the moment the still frame shows; your browser runs the same seed to the same moment and carries on from there. For those to be one market, two things that browsers usually leave to chance are fixed. The clock moves in whole quanta of 1/60 of a simulated second, so a 60 Hz screen and a 144 Hz one draw the same order flow. And the market computes its own exponentials and logarithms, from IEEE arithmetic alone, because engines may round Math.exp differently in the last bit, and one bit in a decay grows into a different market within seconds. A fingerprint of the market twenty seconds after the still frame is pinned in the tests, and Chromium, WebKit and Firefox each reach it exactly; with ?debug=1 the figure shows whether your browser does.

How it is tested

  • Time rescaling: if the simulation is exact, each kind’s intensity integrated between its events is exponential with mean one. A Kolmogorov–Smirnov test holds that for every kind and for all of them together, over five seeds, each family (per kind, and pooled) at a 1% family-wise level; the intensity it integrates is rebuilt from the event times and the model alone, so a simulation that drifted from the model would fail it.
  • Over ten seeds: the event rate, the realised volatility and the spread stay in the calm market’s range.
  • The share of events that arrive on their own, not set off by another, matches Σμ over the stationary total.
  • The book never crosses, no queue goes negative, and every market order fills at the touch of its moment, over a million events.
  • Six hundred single steps are the same market as ten one-second ones, and the still frame followed by the live run is one straight run.
  • The market’s exponential and logarithm agree with the platform’s to within two units in the last place.
  • Chromium, WebKit and Firefox each run the seeded market to the fingerprint Node pins.
  • Fig. 2 draws each market order’s intensity exactly: just before every one, it equals the model’s intensity rebuilt from the event times alone, to a billionth. What set an order off, by kind, and the chance it came on its own add up to one.

data
synthetic; parameters set by hand
references
Hawkes, Spectra of some self-exciting and mutually exciting point processes, Biometrika 58(1), 1971 · Ogata, On Lewis’ simulation method for point processes, IEEE Transactions on Information Theory 27(1), 1981 · Bacry, Mastromatteo and Muzy, Hawkes processes in finance, Market Microstructure and Liquidity 1(1), 2015