Simulating Opening and Closing Auctions
Opening and closing auctions clear at a single uncrossing price using their own separate order book and rules, so a continuous-trading fill model applied to auction orders will simulate a market that doesn't actually exist.
Prerequisites: Opening and Closing Auctions, Order Book Mechanics
Continuous trading fills orders one at a time as they arrive, matched against whatever is resting in the book. Opening and closing auctions work completely differently: orders accumulate in a separate auction book for a period, and at a single instant the exchange computes one uncrossing price — the price that maximizes the number of shares that can trade — and every eligible order fills at that same price simultaneously. A simulator that treats auction orders with the same continuous-matching logic it uses for the rest of the day is modeling a market structure that doesn't exist during the auction window.
What makes auction simulation different
Three things a continuous-trading fill model gets wrong if applied to an auction: first, there's no queue-priority walk through the book — every matched order gets the same uncrossing price regardless of when it was submitted, so a naive time-priority fill model will produce the wrong price. Second, auction orders can be cancelled or modified only up until a cutoff (often several minutes before the auction), after which the book is locked — a simulator that allows late cancellation is granting flexibility that doesn't exist in reality. Third, the published pre-auction imbalance (the surplus of buy or sell interest at the indicative price) moves the indicative price as more orders arrive, and strategies that react to that imbalance need the simulator to actually recompute and publish it at realistic intervals, not just reveal the final auction price early.
Worked example: computing an uncrossing price
Simplified auction book at the close, all limit orders:
| Side | Price | Cumulative shares |
|---|---|---|
| Buy | ≥ $50.10 | 3,000 |
| Buy | ≥ $50.05 | 6,000 |
| Sell | ≤ $50.05 | 2,500 |
| Sell | ≤ $50.10 | 7,500 |
At $50.05: buyers willing to pay at least $50.05 total 6,000 shares; sellers willing to accept at most $50.05 total 2,500 shares. Matched volume = min(6,000, 2,500) = 2,500. At $50.10: buyers total 3,000, sellers total 7,500; matched volume = min(3,000, 7,500) = 3,000. The uncrossing algorithm picks the price that maximizes matched volume, so $50.10 wins with 3,000 shares matched — every filled order, buy or sell, executes at exactly $50.10, not at whatever price each individually specified. A simulator that instead walked this book with continuous-trading logic would produce a range of fill prices and a different filled quantity, misrepresenting both.
What this means in practice
Any strategy that trades at the open or close — index rebalancers, closing-auction imbalance strategies, or funds simply choosing to execute at the official close price — needs a simulator with a genuine auction-matching engine, not a continuous-book approximation. Skipping this produces backtests with the wrong fill price, the wrong fill quantity, and imbalance signals that don't behave like the real pre-auction feed, which is particularly damaging for strategies that specifically trade on imbalance information.
Auctions clear at one uncrossing price that maximizes matched volume across an entire accumulated order book, not through sequential time-priority matching — simulating them correctly requires a dedicated auction-matching engine, and applying continuous-trading fill logic to auction orders produces the wrong price and the wrong quantity.
Related concepts
Practice in interviews
Further reading
- Harris, Trading and Exchanges, ch. 5