A latency budget, from the event to the order
Six legs between an event and an order at the venue, how to measure each one on clocks that agree, and why the cheapest milliseconds are usually in your own software.
In a market that reprices within a second of what happens, speed is a chain of steps between the event and an order resting at the venue, and every step takes time. Treating the chain as a budget, with each leg measured and owned by someone, is the only reliable way we know to make it shorter.
The legs
- The event to its first record. Something happens on a pitch, on a game server, in a market. Someone or something records it: a scout with a handset, the game's own event log, a matching engine. The trader does not control this leg, but he does choose it, because different sources record the same event at different points.
- The record to distribution. The provider validates, formats and publishes. Some providers hold updates back for checks or for contractual reasons; others stream the raw record as it is made.
- Distribution to receipt. Transit to wherever the trader's machine sits. Light in optical fibre covers about 200 kilometres a millisecond, so a thousand kilometres costs at least five milliseconds each way before any router touches the packet. The route matters as much as the distance.
- Receipt to decision. Decoding the message, updating state, running the model, checking risk limits. In well-built software this is the smallest leg; in badly built software it is the largest, and it is the one entirely in the trader's hands.
- Decision to the venue. Building the order, signing it where the venue needs a signature, sending it, and passing whatever the venue puts in front of its matching engine: authentication, rate limits, its own risk checks.
- At the venue. Queueing and matching. Some venues add a deliberate delay to orders in live markets. Some collect orders into batches, auctions or blocks, which turns latency from a continuous race into a question of which batch an order makes.
Measuring it
A budget needs a measurement at every boundary, and that needs clocks that agree. Each machine is disciplined to a reference clock and its offset is logged, so that a timestamp taken on one host can be compared with a timestamp taken on another. Every message carries the time it was received and the time each stage finished with it. Where the source publishes its own timestamp, that is kept too, because the gap between the source's clock and ours is itself a measurement: of the provider's processing, of the network, and of drift.
The measurements are read as distributions. A median of a few milliseconds says little if one update in a hundred takes half a second, and in a fast market the slow updates tend to arrive exactly when a lot is happening at once, which is when they matter most. The useful view is each leg's distribution, and its tail during the moments that carry the money.
Where to spend
The legs are not equally cheap to shorten. Software is usually the best return: removing a copy, a lock, an allocation or a needless round trip costs engineering time and nothing else. Placement comes next: a machine near the source and another near the venue, joined well, can remove most of the transit. The source itself is often the largest leg and the most expensive to change, because the faster source is usually a different product at a different price.
It is easy to spend on the wrong leg. A faster connection to a venue that matches in fixed intervals buys nothing unless it moves the order into an earlier interval. A faster source is worth nothing if the decision behind it waits on something slow. A paid route to a venue is worth what it changes in where the order lands, and that can be measured directly by racing it against the route already in use on real orders.
So the question to ask of each improvement is what it changes at the end of the chain: which orders now arrive in time that did not before, and what those orders are worth.
The budget is set by the market
How fast is fast enough depends on the market. Where a price moves within a few hundred milliseconds of an event, being a second late is the same as not trading at all. Where a price drifts for hours on slow information, a second is irrelevant and the model is everything. Part of choosing what to trade is choosing markets where the budget we can reach is the budget the market rewards, and saying no to the ones where it is not.