Introduction to Algorithmic Execution - Part 9: Smart Routers
Published by: OrderX
•
How child orders find the right venue: sweeping lit books with IOCs, modeling limit-order queues, and trading safely in the dark.

Every algorithm in this series eventually produces the same output: a child order that must be sent somewhere. In a fragmented market - dozens of equity venues, or a dozen crypto exchanges each with its own book - that “somewhere” is a genuine optimization problem. The smart order router (SOR) solves it. It sits beneath the scheduling logic: the parent algorithm decides price, size, and timing; the router decides destination.
Because marketable, displayed-passive, and dark orders face different problems, routers are typically built as three sub-engines:
a market order router for orders that demand immediate execution,
a limit order router for displayed resting orders, and
a dark aggregator for hidden liquidity.
The Market Order Router
Splitting and Sweeping
Given an order to execute now, the router compares the consolidated picture of all venues and splits the order to capture the best blended price. If venue C shows 100 units at $19.99 while venue A shows 100 at $20.00, a 200-unit buy goes 100/100 - a better average than sweeping either book alone. In crypto the same computation must also net out venue-specific taker fees: a nominally better price on a high-fee venue is often the worse trade after fees.
The In-Flight Problem
Quotes can vanish during the milliseconds an order travels. A plain market order that arrives after its target quote is gone will chase the book to whatever price remains - so routers instead send IOC marketable limit orders pinned near the targeted price: if the liquidity is gone, the slice cancels back instead of walking the book. Routers also synchronize the arrival timing of split legs. If one leg lands visibly earlier, observers can recognize the start of a sweep and fade their quotes on every other venue before the rest arrives.
Probing Hidden Liquidity
Venues may hold midpoint and reserve liquidity that no feed displays. Routers discover it by pinging - small IOCs sent at or inside the midpoint. For small orders, cycling pings through venues is cheap. For large orders, a stream of small fills is itself a signal: a burst of partials tells the market someone big is working. The defense is a minimum acceptable quantity (MAQ) on the order - “fill me only in size” - which trades some fill probability for silence.
Router vs. Strategy
A useful boundary: the market order router is a fast, mostly memoryless tool - it acts on the current snapshot. Opportunistic algorithms (Part 7) are strategic layers above the router that decide when engaging is worth it at all.
The Limit Order Router
Picking the Best Queue
For a non-marketable order - bidding $19.98 against a $20.00 ask - the question becomes: on which venue will this order fill soonest? Intuition says the shortest queue, but the right mental model is the checkout line: what matters is queue length divided by service rate. A venue with 500 units ahead of you trading 1,000 units a minute beats a venue with 100 units ahead trading 10 a minute.
Two wrinkles make it genuinely hard. First, the answer depends on your order’s size: a small clip cares about the front of one queue, while a large order ultimately needs the venue with the deepest sustained flow, even if its queue starts longer. Second, fee structure warps behavior - inverted (taker-maker) venues attract takers, so queues there drain faster per unit of displayed depth (see Part 2 on fee models).
From Queuing Theory to Learned Models
Clean queuing formulas miss too much of this, so production routers are empirical: logistic-regression fill-probability models over features like spread, volatility, venue market share, and displayed depth - and increasingly nonlinear learners (gradient-boosted trees, neural networks) that capture regime effects, such as how taker flow migrates between venues as cheap liquidity exhausts. The models are retrained continuously because venue dynamics drift with every fee change and every new participant.
The Dark Aggregator
Midpoint Economics
The dark aggregator manages resting exposure across hidden venues, where matches typically print at the midpoint - buyer and seller split the spread, and neither shows a thing pre-trade. With no visible queues to model, the aggregator allocates on historical fill rates and live feedback: which pools have been producing fills, at what sizes, against what counterparties.
Ping, Post, Pounce
A classic allocation cycle: ping every pool with IOCs to find resting interest; post residual quantity in the pools ranked most promising; and when a posted order suddenly fills in full, pounce - send more size immediately, because a complete fill usually means the counterparty had more behind it.
Staying Safe in the Dark
Dark trading has predators too. Adverse counterparties run their own pinging campaigns to locate institutional size and trade ahead of it. Defenses come in layers:
MAQ: forcing counterparties to fill in size makes detection expensive rather than free.
Counterparty tiering: many pools let participants restrict matching to “benign” segments - natural institutional flow - and exclude the sharpest short-horizon participants.
Conditional orders: to rest meaningful size in many pools at once without risking overfills (five pools each filling the full remainder), the aggregator posts non-binding conditionals. When a pool finds a match it sends an invitation to firm up; the router commits real quantity only then, sized to what actually remains. Discipline matters - repeatedly declining invitations (“fall-downs”) gets a participant penalized or ejected, and conditionals themselves can be abused by fishers probing for size, so reputable pools police both sides.
The router completes the execution stack’s where. The remaining tactical question is how each child order should be priced, sized, and displayed - the placement logic of Part 11. And for how routing changes when venues don’t share a tape or a clearinghouse, see Part 14 on crypto execution.


A new way to
trade is here.
OrderX equips serious traders with the tools they’ve been waiting for Structured execution, integrated systems, and built-in intelligence.


