Table of Contents
- Introduction: The Gate That Approved What It Should Have Blocked
- The Two-Copy Problem: Why Position State Diverges Under Load
- The $4M Reconciliation Tax: Why Post-Hoc Agreement Does Not Protect the Hot Path
- What the Markout Curve Reveals: Adverse Selection Concentrates in the Stalest Bucket
- Sequencer Discipline: Stamping Every Event on a Single Ordered Stream
- The High-Water Mark Control: Refusing Rather Than Approving Against a Known Stale Number
- Diagnostic Framework: Questions to Run Against Your Own Architecture
- Conclusion
Introduction: The Gate That Approved What It Should Have Blocked
A pre-trade risk gate has one job: reject any order that would push the desk past its position limit. But a gate can only check the position it sees. When the position it sees is not the position the desk actually holds, the gate becomes a control that passes a compliance audit and fails in a fast market.
This is not a theoretical failure mode. I was brought in over the rebuild after it surfaced at one desk. The gate had been approving orders against a position the desk no longer held. A few hundred microseconds stale on every fill in a fast market: long enough to clear size over the real limit without the gate ever registering a breach.
The mechanism is structural. Fills reached the OMS on the order-entry session and the risk gate over a separate bus hop, arriving a beat later. Same events, two arrival times, so within that window each component held a different position. A limit checking the stale number approves the order without complaint. The compliance record looks clean. The real exposure does not match it.
Thank you for reading this post, don't forget to subscribe!
The instinct in most shops is to reconcile the two copies of position. That desk spent about $4M on a layer to keep them agreeing under load. They still drifted. Reconciliation runs after the fact; the hot path does not wait for it.
The correct fix is not reconciliation. It is eliminating the category of problem: a single monotonic event stream where every component folds the same ordered sequence into its own state. A component that is behind knows it is behind, and the gate refuses rather than approves against a number it knows is stale.
What follows is how the failure manifests, how you find it in your own fill data, and what the fix looks like.

The Two-Copy Problem: Why Position State Diverges Under Load
In a typical HFT stack, the risk gate and the OMS are separate processes. They need to be. The gate needs to check position on each order, at order-entry latency. It cannot call out to a shared service on each check without adding latency that destroys the business model. So the gate maintains its own local copy of position.
That local copy is populated by the same fill and cancel events that the OMS processes. But “same events” does not mean “same arrival time.” The events travel different paths. The order-entry session and the risk gate receive those events over separate bus hops: shared memory segments, UDP multicast channels, or TCP sockets, depending on the topology. Each path has its own latency profile. Even on shared memory, scheduler jitter creates ordering differences under load.
The result is that at any given moment, two components hold two different positions. The magnitude of the divergence is a function of bus topology and market velocity. On a quiet day, the difference might be a handful of microseconds, negligible for most purposes. In a fast market, where fills are arriving at high frequency and the bus is loaded, the gap widens. The actual delta ranges from tens of microseconds to low milliseconds depending on whether the path is shared memory, UDP multicast, or TCP. The gate’s position can fall behind by one fill, two fills, three.
Each of those lagging fills represents an increment of exposure that the gate cannot see yet. When an order arrives at the gate while those fills are in transit, the gate checks a limit against a number that is smaller than the real position. If the real position is at or near the limit, that order should be rejected. Instead it clears.
The failure is not that any individual component is wrong. The failure is that the two-copy architecture has no mechanism to communicate which copy is current. Both look authoritative. Neither can say: I am behind, do not trust my number.

The $4M Reconciliation Tax: Why Post-Hoc Agreement Does Not Protect the Hot Path
The standard engineering response to two diverging copies is to reconcile them. Build a layer that compares the two position records, detects differences, and resolves them. It is the right answer for eventual consistency. It is the wrong answer for the hot path.
The desk I reviewed spent about $4M on exactly this: a reconciliation layer that sat between the OMS and the risk gate, comparing position snapshots and pushing corrections when it detected drift. It was well-engineered. It ran fast. And it still failed to prevent the overrun.
The reason is timing. Reconciliation runs after events have already been processed. By the time the layer detects that the gate’s position is behind the OMS position, both components have already acted on their respective views. The correction arrives after the damage, not before.
Worse, the reconciliation layer adds a processing step between event arrival and state update. Under load, that step becomes a constraint: the hot path slows or corrections queue up, and the divergence window grows precisely when correct position state matters most.
The reconciliation layer did not fail because it was badly built. It failed because it was solving the wrong problem. The two-copy architecture creates an inherent race condition. Reconciliation can reduce steady-state divergence, but it cannot eliminate the window between event arrival and state correction. That window is the failure mode.

What the Markout Curve Reveals: Adverse Selection Concentrates in the Stalest Bucket
The failure mode is visible in the fill data after the fact, if you know where to look. The diagnostic is a markout analysis bucketed by position staleness at fill time.
A markout, as defined in the Databento Microstructure Guide, is the price change within some arbitrary time interval before or after an event such as a fill. A falling markout, meaning a negative trend in the periods after the fill, indicates adverse selection: the market moved against the position after the trade was executed.
The diagnostic works as follows. For each fill that cleared the risk gate, measure how stale the gate’s position was at the moment it checked. Stale here means the difference between the sequence position the gate had applied and the sequence position that was current in the system at that moment. Bucket those fills by staleness: fills where the gate was current, fills where it was one event behind, two events behind, three events behind, and so on.
Then compute the markout for each bucket. What I have seen across systems with this failure mode is that adverse selection concentrates in the stalest buckets. The fills that cleared while the gate was most behind show the worst markout: approved against a limit already consumed, these are the fills that should have been blocked.
When adverse selection concentrates in the stalest bucket, you are not looking at noise. You are looking at a position state problem visible in data you already have.
This is also a diagnostic you can run now, without waiting for an incident. Pull six months of fills. Compute, for each fill, the sequence gap between what the risk gate had applied and what the OMS had applied at that moment. Bucket. Plot markout by bucket. A flat distribution means the position state architecture is not generating adverse selection. A concentration in the stalest bucket means the problem has been accumulating in production.

Sequencer Discipline: Stamping Every Event on a Single Ordered Stream
The fix is at the source, not at the layer between the two copies.
The architectural move is to introduce a sequencer: a component that stamps every fill, cancel, and acknowledgment with a monotonic sequence number before any other component processes it. Every consumer of that stream, including the OMS and the risk gate, folds events into their local state in sequence-number order. There is no longer a question of which component’s position is current. Current means highest sequence number applied. Stale means lower sequence number than the current high.
This is not a new pattern. Thompson, Farley, Barker, Gee, and Stewart documented the LMAX Disruptor architecture in 2011, establishing the monotonic sequencer as the correct foundation for high-throughput trading system event processing. The LMAX Business Logic Processor, processing events from a single ordered Disruptor queue, demonstrated throughput of 6 million orders per second on a single thread. Martin Fowler’s 2011 analysis noted that event sourcing from a single ordered stream also provides a durable audit trail: replay the stored event log to recreate any component’s state at any point in time.
More recently, Adaptive’s Aeron Sequencer (announced January 2026) applies the same principle at the level of state machine replication: multiple nodes deterministically process the exact same sequence of inputs in order, achieving latency as low as 18 microseconds on-premises at throughputs of many millions of messages per second.
The sequencer pattern also makes jitter visible: a consumer with a gap in received sequence numbers knows it is behind, and by exactly how many events. This observable gap is the property the high-water mark control exploits.
Exchange market data feeds apply the same principle: sequence numbers increase monotonically, and a gap means the recipient’s order books are incorrect and recovery must begin. The same logic applies to internal position state.

The High-Water Mark Control: Refusing Rather Than Approving Against a Known Stale Number
The sequencer is necessary but not sufficient. A component with a gap in its applied sequence numbers could still process orders against stale state, simply being unaware that it is behind. The control that closes that gap is the high-water mark comparison.
To be precise: the high-water mark here is the highest sequence position the sequencer has published to the stream. This is a technical term from the sequencer pattern, distinct from the NAV high-water mark used in fund performance contexts.
The mechanism: the risk gate tracks two numbers. The first is the highest sequence number it has applied to its own position state. The second is the published high-water mark from the sequencer, meaning the highest sequence number that has been committed to the stream. The difference between them is the gate’s current staleness.
The gate is configured with a staleness budget: the maximum gap it is permitted to carry before acting. When the gap between the gate’s applied sequence and the published high-water mark exceeds that budget, the gate refuses to approve any order. It does not try to guess whether the pending events would change the position enough to matter. It refuses. It compares its applied sequence to the published high-water mark, and once the gap crosses its budget it refuses rather than clears against a number it knows is stale.
This is a deliberate design choice. It means the gate will sometimes block orders that might have been safe to execute. That is the correct tradeoff. A blocked order is recoverable: the position updates arrive, the gap closes, the gate resumes approving orders. An overrun past a real position limit is not recoverable in the same way, and in a regulated environment, it carries legal consequences.
The regulatory context is relevant here. SEC Rule 15c3-5, the Market Access Rule with compliance date July 14, 2011, requires broker-dealers to prevent the entry of orders that exceed appropriate pre-set credit or capital thresholds. The SEC’s 2013 enforcement against Knight Capital Group ($12 million settlement, the first under Rule 15c3-5) traced to a stale feature flag active on one of eight servers during a 45-minute incident on August 1, 2012. The SEC’s 2016 enforcement against Merrill Lynch ($12.5 million civil penalty, at least 15 market disruption incidents from late 2012 to mid-2014) found controls configured so high they were functionally disabled.
In both cases the gate existed. In both cases it did not gate. The FINRA 2024 Annual Regulatory Oversight Report added the Market Access Rule as a new examination priority, flagging insufficient controls and failure to consider additional data as recurring findings. A high-water mark gate that refuses to approve against known-stale state directly addresses both: the staleness of the gate’s position is data, and the correct control uses it.
Diagnostic Framework: Questions to Run Against Your Own Architecture
These are the questions that reveal whether the problem exists before an incident does.
1. How does position state arrive at your risk gate?
If position updates travel a different path than the order flow, the two-copy problem exists in your architecture. Identify the bus topology: shared memory, UDP multicast, or TCP. The worst-case divergence window is a function of that topology and the load profile during fast markets. Calculate it explicitly. If you cannot calculate it, you do not know your exposure.
2. What does your gate do when it knows it is behind?
Most gates do not have a staleness detection mechanism at all. If yours does not compare an applied sequence to a published high-water mark, or equivalent, it cannot distinguish between “I have the current position” and “I have a position from three fills ago.” Ask the engineering team directly: what is the gate’s behavior under a detected position state gap? If the answer is that the gate does not detect gaps, that is the finding.
Running the replay test in the conclusion requires that your logging already captures the applied sequence number at the risk gate at the moment of each order check, alongside the OMS’s applied sequence at that same timestamp. If your current logging does not emit this, the instrumentation is the prerequisite: add a monotonically stamped position-state snapshot to the gate’s order-check log. Without it, you can observe adverse selection in the markout curve but cannot tie it to sequence-gap magnitude directly.
3. Have you run a bucketed markout analysis by gate staleness?
Pull six months of fills. For each fill, compute the staleness of the gate’s position at approval time. Bucket by staleness. Compute markout per bucket. If adverse selection concentrates in the stalest bucket, the two-copy problem is already costing you in fill quality, and you have the forensic record to quantify it.
4. What is the total cost of your reconciliation infrastructure?
Account for its full cost: initial build, ongoing maintenance, latency added under load, and incidents not prevented. Reconciliation infrastructure that runs to several million dollars while still allowing divergence in fast markets is a signal that the approach is wrong.
5. Is your gate’s staleness budget defined and tested under load?
If the gate has a staleness budget, confirm it is based on measured divergence during fast market conditions, not a theoretical maximum. That calibration requires empirical data from your actual topology, not estimation.
6. What is your annual review process for pre-trade risk control effectiveness?
The FINRA 2024 report flagged inadequate documentation of annual review as a recurring finding under the Market Access Rule. The staleness budget and high-water mark mechanism should be part of that review: measured against actual staleness distributions from the prior year and documented with the specific parameters used.
Conclusion
The desk I described had a risk gate that passed every audit and still cleared orders past the real position limit in a fast market. The gate was not defective. The architecture was defective: two copies of position state with no mechanism for either to know it was behind.
The fix is a sequencer at the source: a single ordered stream every component reads, and a gate that compares its applied sequence to the published high-water mark and refuses when the gap exceeds its budget.
Here is the test that falsifies the architecture: in a replay of your fastest market session from the last 12 months, compute the maximum divergence between the risk gate’s applied sequence and the OMS’s applied sequence at the moment each order was approved. If that maximum is zero, your architecture has this covered. If it is not zero, the size of the maximum is the size of the exposure window that was open during your busiest trading day of the year. That number is worth knowing before the next fast market, not after.
This article was originally shared as a LinkedIn post. View the original post
Never Miss an Update
Get notified when we publish new analysis on HFT, market microstructure, and electronic trading infrastructure. No spam.
Subscribe by EmailHFT Systems Architect & Consultant | 20+ years architecting high-frequency trading systems. Author of "Trading Systems Performance Unleashed" (Packt, 2024). Creator of VisualHFT.
I help financial institutions architect high-frequency trading systems that are fast, stable, and profitable.
>> Learn more about what I do:
https://hftAdvisory.com
>> Your execution logs contain $200K+ in recoverable edge.
>> Microstructure Diagnostics — one-time audit, 3-5 day turnaround
https://hftadvisory.com/microstructure-diagnostics
... more info about me 👇