Routing: Turning One Order Into Several Fills

Liquidity for a Solana pair is rarely in one place. The same token may trade against SOL in a constant-product pool, against a stablecoin in a concentrated-liquidity pool, and against both on a second venue with a different fee tier. A router exists because the best price for a given size is often a weighted combination of those pools rather than any single one of them.

Splitting works for a specific mathematical reason: price impact grows faster than linearly with size, so two half-size fills against two pools cost less in total than one full-size fill against one. The same convexity explains why an optimal split is uneven rather than an even division, and why the gains shrink with each additional leg until the added fees and the added failure surface outweigh them.

That failure surface is the part traders underestimate. Every extra hop adds accounts to the transaction, consumes more compute, and creates more state that can change between the quote and execution. A route that prices better on paper and lands less often is not obviously the better route, which is why this section treats price improvement and reliability as two axes rather than one.

2 pieces in this section

How a router turns one order into several fills, why splitting lowers price impact, and what a longer route costs you in fees and failure risk.

Where this section sits

Routing decisions only pay off if you can price them. The cost section turns route shape into a line-by-line cost figure and a measurement you can compare across paths.

Execution basics

Definitions and mechanics. What a quote is, what moves it, and which parts of the gap between quote and fill you actually control.

Cost model

The full cost stack of a swap, the risks that inflate it, and the measurement discipline that tells you whether a change helped.