Skip to main content
Every single-chain quote is a comparison. Olympex asks each of its liquidity sources to price your pair and amount, ranks the quotes that come back, and returns the winner together with the order of the sources that quoted. You build the transaction with the winning source, and keep the others as fallbacks.

Liquidity sources

Olympex requests single-chain quotes from several DEX aggregators and DEXes on each chain. Quotes identify each source by its dexHash, 0x and 64 lowercase hex digits, and you pass the winner’s dexHash to POST /swap. A dexHash identifies a source, not a quote: it stays the same from one quote to the next. Copy it from the quote as it is, in lowercase: an uppercase hash returns 400 VALIDATION_ERROR. Which sources quote varies by chain and over time, so read aggregatorOrder in each quote instead of assuming a source is available. When the quote fills market[], its dexName is a display name for the source. Cross-chain transfers use a separate set of providers with their own dexHash values, covered in Cross-chain mechanics.

How the winner is chosen

For a single-chain quote, Olympex requests a quote from each source it doesn’t exclude. Sources that fail or return nothing drop out. The rest are ranked by params.orderBy: The dexHash of the first source in the ranking becomes the quote’s dexHash, and the full ranking is returned as aggregatorOrder, a list of dexHash values. MAX_OUT_AMOUNT compares output amounts only; it doesn’t subtract gas. When gas is a large share of the trade, estimate the gas cost yourself from estimatedGas and the chain’s gas price, and weigh it against the output before you show the quote. The gas-based orderings rely on each source’s own estimatedGas, and a source that gives no estimate reports "0" or omits estimatedGas, so treat those rankings with the same caution as the estimates. Gas and fees explains the gas fields. orderBy, excludeMetaAggregatorId and gasMultiplier apply to single-chain quotes only. gasMultiplier is echoed in the quote and doesn’t change it.

Excluding sources

params.excludeMetaAggregatorId takes an array of source IDs to leave out of the comparison. Quotes return dexHash values, not IDs. Olympex shares the source IDs on request: contact partners@olympex.io.
Unknown IDs are ignored, so a misspelled ID excludes nothing and returns no error. IDs are case-sensitive, and a dexHash isn’t an ID: passing one excludes nothing. Common reasons to exclude a source are a /swap failure you want to route around on the next quote, and your own policy about which venues you use.

Reading the route

A single-chain quote describes the route the winning source found. This excerpt comes from a quote for 10 USDT to USDC on Polygon, with the fields that describe the route:
Quote excerpt
The breakdown comes from the winning source in that source’s own shape, and the level of detail varies by source. In the excerpt, the first two routes report 90.2375 and 9.7625 (with the source’s floating-point noise), then four more routes report 100 for the later hops. Use routes and market to show users how their trade is filled, not for accounting. The amounts that count are outAmount from the quote and minOutAmount from /swap.

Falling back with aggregatorOrder

aggregatorOrder lists the dexHash of every source that returned a quote, best first, and starts with the winner. In the example above, the first value is the winner’s dexHash, and the others belong to the other sources that quoted. Fall back in either of these cases:
  • POST /swap fails with 422 NO_ROUTE or 500 SWAP_ERROR for the winning source.
  • POST /swap succeeds, but eth_estimateGas of its calldata reverts. A 200 doesn’t guarantee that the calldata executes: a source can build calldata that reverts. When the allowance, the balance and the expiry are in order, the route itself can’t execute, and building again with the same source returns the same route.
You then have two options:
  • Retry /swap with the next dexHash in aggregatorOrder.
  • Request a fresh quote, optionally excluding the failed source by its ID, and build with the new quote’s dexHash.
A cross-chain quote has no aggregatorOrder: request a new quote instead. Each source prices the trade separately, and a fallback can return noticeably less than the winner. Compare swap.outAmount and swap.minOutAmount from the fallback response with what you showed, and show them to the user before anyone signs: they are what the calldata commits to.

When no route is found

If no source can quote the pair and amount, POST /quotes returns 422 with NO_ROUTE, for single-chain and cross-chain quotes:
NO_ROUTE also covers every source failing or not answering in time, so it can be temporary: Olympex doesn’t tell the two cases apart. The detail text varies by mode and cause. Branch on error.code, and don’t parse message or details. Retry with backoff, and sign each attempt again. If it persists, try a different amount or pair, and check that your exclusions haven’t removed every source that can fill the trade.

Quotes are not reserved

A quote reflects the sources’ prices at the moment you asked. Olympex doesn’t hold that price for you, so request /swap right after the quote and send the transaction right after /swap. Some routes include a market maker’s firm quote (an RFQ leg) whose price expires within seconds of the build. Send those at once, and if the transaction reverts because that quote expired, build the swap again. Slippage and price impact covers how your slippage setting protects the trade in between.

What this means for your integration

  • Pass the quote’s dexHash to /swap unchanged, and keep aggregatorOrder for fallbacks when /swap fails or its calldata doesn’t pass eth_estimateGas.
  • Don’t reuse old quotes. Request a new one when the user changes the pair or amount, and before you build a transaction.
  • Show the user swap.outAmount and swap.minOutAmount, not the quote, as the final numbers.
  • Treat routes and market as display data whose shape varies by source.

Slippage and price impact

How much the price can move, and what your trade size costs.

Gas and fees

Gas estimates and integrator fees.

Get a quote

The POST /quotes reference.

Get a swap quote

The step-by-step guide.