Smart Order Routing (SOR)
Smart Order Routing (SOR) is an algorithm used by DEX aggregators to split a trade across multiple liquidity sources — different AMM pools, aggregators, and private market makers — to achieve the best overall execution price. The router solves an optimization problem: given the liquidity curves of N venues and a trade of size S, find the allocation across venues that minimizes the average execution price net of gas costs. This is a convex optimization problem for most AMM curves, solvable on-chain or off-chain quickly. SOR must account for gas costs (each additional pool hop adds base transaction overhead) and slippage (larger fractions to a single pool increase price impact). Advanced SOR systems like the 1inch Aggregation Protocol and UniswapX's router incorporate RFQ quotes alongside on-chain liquidity and may split across multiple blockchain networks. SOR significantly improves execution for retail and institutional traders who would otherwise get worse prices executing against a single venue.