Quant Memo
Core

Simulating Acks, Rejects and Exchange Responses

Sending an order to an exchange isn't instant or guaranteed — there's a round-trip delay before an acknowledgment comes back, and the order can be rejected outright for reasons that have nothing to do with the market, both of which a realistic backtest needs to model rather than assuming every order is instantly and silently accepted.

Prerequisites: Discrete-Event Scheduling in Backtest Engines

A naive backtest treats sending an order as instantaneous and guaranteed: the strategy decides to buy, and in the same simulated instant the order exists in the book. Real exchanges don't work that way. An order travels over a network, gets validated by the exchange's gateway, and only then is either acknowledged (accepted into the book) or rejected — for reasons ranging from a price outside allowable bands, to exceeding a risk limit, to a malformed message — with a real, non-zero delay before either response arrives. A simulator that skips this step is implicitly assuming zero latency and 100% acceptance, both of which are false in live trading and both of which make a strategy look better in backtest than it can perform live.

Modeling the round trip

The realistic sequence has at least three timestamps: the order is sent at t0t_0, it's processed by the exchange and a response is generated at t0+δint_0 + \delta_{in} (the inbound leg of latency), and that response — ack or reject — arrives back at the strategy at t0+δin+δoutt_0 + \delta_{in} + \delta_{out} (after the outbound leg). Only once the ack is received does the order actually exist in the book from the market's perspective; anything that happens to the market between t0t_0 and the ack's processing time — a price move, a competing order arriving first — happened before your order was live, and a simulator has to respect that ordering. Rejects need their own model too: a fixed small probability isn't realistic on its own, since real reject rates spike around specific triggers like a price moving outside a fat-finger band or a self-imposed risk check firing, and a simulator that never rejects orders is quietly assuming a level of message hygiene and risk-limit headroom the live system may not have.

t₀ order sent inbound latency exchange processes outbound latency ack / reject received order live in book only after ack
An order isn't in the book the instant it's sent — it becomes live only after the full round trip completes, and market events before then happened before the order could have participated.

Worked example: a race the naive backtest misses

A strategy sends a buy order the instant a price update signals a favorable opportunity, at t0=10:00:00.000t_0 = 10{:}00{:}00.000. Round-trip latency to this venue is 3ms. A naive backtest, treating the order as instantly live, checks whether the order would have filled against the book as it stood at t0t_0 — and finds a favorable fill. A latency-aware simulator instead checks the book as it stood at t0+3ms=10:00:00.003t_0 + 3ms = 10{:}00{:}00.003, and in those 3 milliseconds the price has already moved away, because the same public price update that triggered the strategy's decision was also visible to every other participant with equal or lower latency. The realistic simulation shows a worse fill price or no fill at all — this gap, systematically in the strategy's favor when latency is ignored, is one of the most common sources of backtest overstatement for any signal built on public, low-latency information.

What this means in practice

Any strategy that reacts quickly to market events needs latency-aware simulation of the order round trip, not just fill modeling — the two are different problems, and skipping the first quietly inflates results for exactly the strategies most sensitive to speed. Reject modeling matters less for slow, low-frequency strategies but becomes material for anything sending a high volume of orders or operating close to risk limits, where a nontrivial reject rate changes both effective fill rate and the operational logic needed to handle rejected orders gracefully.

Orders take real time to reach an exchange, be validated, and come back as an acknowledgment or a reject — a backtest that treats order submission as instantaneous and always-accepted overstates performance for any strategy that reacts quickly to public information, because it lets the strategy act on information before competitors realistically could have too.

Related concepts

Practice in interviews

Further reading

  • Harris, Trading and Exchanges, ch. 5
ShareTwitterLinkedIn