HostDeFiGuides › Aggregator pricing

How does a DEX aggregator get the best price? Routing, explained

Your one swap is quietly split across dozens of pools and reassembled as the best output the market can offer. Here's what the router is actually doing — and why two aggregators can quote different "best" prices.

Educational guide · reviewed September 2026 · not financial advice

A DEX aggregator finds the best price by treating your swap as a routing problem across every pool it can reach: it splits your order, sends pieces through whichever combination of pools produces the most output tokens, and returns the result as a single transaction. The "price" you see isn't a price at all — it's the answer to an optimization: across all the liquidity I know about, what path converts your input into the most output?

That optimization is the whole product, and understanding it explains three things users constantly misread: why the number moves, why quotes differ between aggregators, and why the fill can differ from the quote.

Why one pair has many prices

There is no "the price" of a token on a DEX. There are pools — dozens or hundreds of them for a liquid pair — and each holds its own ratio of the two tokens, its own fee tier, and its own depth. A constant-product pool prices every marginal unit slightly differently depending on its balance; a concentrated-liquidity pool prices differently again inside each range band. Buying SOL→USDC against pool A might fill at a rate a hair better than pool B, while pool C beats both on the first slice and turns much worse once your order eats past its tight range. Every pool is a separate venue with a separate price, and your order is a customer that can visit all of them at once.

This is the problem a trader on one DEX can't solve by eyeballing a single quote: the best single-pool price is rarely the best achievable price.

What the router does with your order

1

It builds a graph of every reachable pool

Every pool the aggregator indexes becomes an edge in a graph: token A connects to token B through pool X at price P with depth D. On Solana that's thousands of edges across Orca Whirlpools, Raydium pools, Meteora's dynamic AMM and DLMM bins, PumpSwap, Lifinity, and more — all refreshed continuously as pools rebalance.

2

It finds paths, including multi-hop ones

Sometimes the best route isn't direct. SOL→USDC might beat every direct pool by routing SOL→JUP→USDC, or SOL→wBTC→USDC — two swaps whose combined output exceeds the single-swap route. The router searches the graph for paths, not just pools, which is why a good aggregator occasionally produces a better price than the pair's own flagship pool.

3

It splits your order across the winning paths

This is the non-obvious part: the optimal fill is usually not one route but a portfolio of routes. Send 60% through the deep pool, 30% through the better-priced shallow pool until its price degrades, 10% through a two-hop path — each slice pushed until marginal output equalizes across slices. The math is the same logic a market maker uses; the router does it in milliseconds per quote.

4

It nets out fees and price impact into one number

Pool fees, price impact from your own order size, and on some routes referral or platform fees all reduce output. An honest aggregator quotes output after all of it — the number that actually lands in your wallet — which is why comparing headline rates between venues is meaningless and comparing quoted output is the only fair test.

Why two aggregators quote different "best" prices

Both are telling the truth about a different question:

Why quotes differWhat's happening
Different pool graphsAn aggregator only optimizes over pools it indexes. A brand-new Meteora DLMM might hold the best liquidity for a fresh token and only show up in the routers that have indexed it.
Different objectivesSome optimize raw output; others optimize output-minus-gas, or apply MEV-protection routing that trades a hair of price for execution safety.
Different timingQuotes are computed at different instants on a moving market. A quote generated 800ms later is a quote for a different market.
Different fee layersInterface fees, referral fees, and integrator fees are subtracted by some routers and not others. Always compare final output, never the exchange rate.

The practical consequence: quote competition is real and worth 10 seconds. Two aggregators quoting the same swap can differ by fractions of a percent on liquid pairs and by whole percentages on thin ones — the reason quote comparison across venues is worth the ten seconds it takes.

Why the fill differs from the quote

A quote is a snapshot of a market that keeps moving while your transaction travels. Between quote and confirmation: other trades move the pools, prices drift, and — on pairs where it's profitable — searchers attempt to reorder transactions around yours. Your slippage tolerance is the boundary you set for how much drift you'll accept: too tight and trades revert on normal volatility, too wide and you absorb losses you didn't need to. Slippage settings for memecoins covers the tuning; MEV and sandwich attacks covers who profits from the gap.

The honest way to compare aggregators: same pair, same size, same moment — compare quoted output after all fees, and on a real trade compare the actual fill. HostDeFi's swap routes through Jupiter's aggregation with the token scan on the same page — compare its quoted output against any venue you like; that's exactly what the comparison is for.

What an aggregator cannot fix

Routing optimizes price, not safety. An aggregator will happily find you the best possible price on a honeypot — the round trip fails on the sell leg no matter how good the buy route was. It cannot fix a token with no liquidity (no route exists to optimize), a contract that blocks selling (the sell transaction reverts regardless of route), or a rug where the liquidity disappears between your buy and your sell. Price optimization and contract safety are separate questions, which is why the scan step exists alongside the swap rather than inside the quote.

The short version

The best route into a honeypot is still a loss

Routing optimizes price, not safety — before the quote matters, scan the contract and check whether the sell leg can even run.

Frequently asked

How does a DEX aggregator get the best price?

It treats your swap as a routing problem across every pool it indexes: it splits your order, sends each slice through whichever pools and token hops produce the most output, nets out pool fees and price impact, and executes the result as one transaction.

Why do DEX aggregators show different prices?

They optimize over different pool graphs, at different instants, with different objectives and fee layers. An aggregator only routes through pools it has indexed, and quotes are snapshots of a moving market. Compare quoted output after fees — never the headline exchange rate.

What is a multi-hop swap route?

A route that converts through an intermediate token when the direct path is thin — SOL→JUP→USDC can beat every direct SOL→USDC pool if the two legs' combined output is higher. The router searches paths through the whole pool graph, not just direct pairs.

Why does a swap split across multiple pools?

Because the optimal fill is usually a portfolio of routes, not one. Each slice is pushed into a pool until its marginal output drops to the next pool's level — like water leveling across connected tanks. That's why a 40/35/25 split often beats the best single pool.

Why is my fill different from the quoted price?

The market keeps moving while your transaction confirms: other trades move the pools, and searchers may reorder transactions around yours. Slippage tolerance bounds how much drift you'll accept — too tight and trades revert, too wide and you absorb avoidable losses.

Does the best price mean the token is safe to buy?

No — routing optimizes price, not safety. An aggregator will find the best possible route into a honeypot; the sell leg still fails. Price and contract safety are separate questions — scan the token before you optimize the route.

HostDeFi is an educational risk tool, not financial advice. On-chain data can be incomplete or manipulated; a clean check is a dated snapshot, not a guarantee. Always do your own research. Free · no signup · a HostDeFi product