Openocean routing for split swaps and gas trade-offs
Openocean routing helps when dividing a swap across liquidity sources improves expected output enough to cover any added execution cost. A split sends portions of the input through different paths using liquidity from decentralized exchanges (DEXs). It can reduce pressure on one pool when alternative liquidity remains competitive. Multi-hop routing addresses a different job: reaching the output token through intermediate tokens when that path offers better terms. A direct path remains useful when extra pool interactions add cost without enough improvement. The comparison needs the same input, network, fee treatment, and quotation timing, plus a distinction between estimated output and the amount a completed swap delivers.
Table of contents
Valuing gas in output-token units makes its added cost comparable with a split route's extra quoted output.
Pool depth determines whether splitting earns its cost
Splitting fits a swap when competing pools can absorb portions of its input at better combined terms than one pool offers. Concentrating input in a shallow pool can create price impact, the price change the trade itself causes. Distributing input may limit that pressure if other sources offer competitive execution for their assigned portions. Different execution terms can favor unequal allocations. The relevant gain comes from the combined output for the whole swap, after accounting for execution costs.
A split offers a weak fit when the direct pool already supplies competitive output and extra interactions consume the available improvement.
Comparable quotes need the same cost basis
A fair route comparison holds the input, output asset, network, and fee treatment constant while valuing gas in a common unit.
Quoted output and network charges measure different things. On Ethereum Virtual Machine (EVM) networks, gas units measure execution work, and network fee rules determine the native-asset charge. Comparing token output with gas expenditure requires a common valuation. Expressing gas cost in output-token units makes the additional cost directly comparable with the additional output. Pool charges and any applicable trading fees also belong in the comparison. Before subtracting a pool or trading fee, establish whether the quoted output already reflects it. A changed fee arrangement or an older quote can make an apparent improvement come from a different basis.
Intermediate tokens solve a different liquidity gap
Multi-hop routing fits token conversion when an indirect path offers better available terms than a direct pair. The routing engine can use intermediate tokens when a multi-hop path is beneficial. Each hop exchanges one asset for the next along a path. Splitting determines how much input travels down each branch; hopping determines the exchanges within a branch. A route can combine both mechanisms. Extra hops add interactions and potential pool charges, so a longer path alone does not demonstrate a better return.
When does extra gas outweigh a split route's gain?
Extra gas outweighs a split's gain when its value exceeds the additional output, with other applicable fees held constant.
Does a higher quoted output justify a split? This hypothetical comparison swaps the same input for the same output token on the same supported network. Both quotes include the applicable trading fees. Each gas estimate expresses the native-asset cost in output-token units at one shared valuation time.
The direct path quotes 84.76 output-token units and has an estimated gas cost equivalent to 0.14 units. Its estimated value after gas is 84.62 units.
The split path quotes 85.18 units with gas equivalent to 0.38 units. Subtracting gas leaves 84.80 units, an estimated advantage of 0.18 units.
The split gains 0.42 units of output and adds 0.24 units of gas-valued cost. If its extra gas cost rose above the output gain, the direct path would lead. Gas remains a native-asset expense in this comparison. Subtracting its equivalent value measures the economic gain without changing either quoted token quantity.
V4 fields connect routing to an application
V4 route data lets an application compare proposed paths and apply execution checks before requesting wallet authorization. The
path
and
dexes
fields connect estimated output to the proposed route and participating sources.
Amounts and costs describe different parts of the quote
Token quantities
The response's
outAmount
represents expected output in the output token's smallest units. Token decimal metadata supplies the conversion into readable quantities. V4 requests use
amountDecimals
and
gasPriceDecimals
with full decimal scaling. The older
amount
and
gasPrice
parameters are deprecated in V4. Mixing input conventions can change the requested quantity and invalidate a comparison between routes.
Gas estimates and price impact
estimatedGas
is a reference estimate, so an integration should estimate its constructed transaction's gas against network conditions.
price_impact
describes estimated price deviation.
V4 leaves price-impact execution thresholds to the integrating application.
A competitive quote can still fall outside the application's tolerance for trade-induced price movement.
Routing filters
enabledDexIds
and
disabledDexIds
let requests include or exclude selected DEX indices. The enable list takes priority. Such a quote answers which route fits the permitted source set, so its output need not represent the unrestricted candidate set.
A favorable quote remains separate from a completed swap
A completed swap establishes the received output and actual network cost. A quote records expected terms; transaction data describes what the wallet can sign and broadcast. A transaction's final status and recorded output distinguish successful execution from a proposal. Pool conditions can change between quotation and execution, altering the output within the applicable execution constraints.
On Base, BNB Chain, and Ethereum, V4's
minOutput
parameter sets a minimum target-token quantity in smallest units. Execution fails if actual output falls below it. This condition protects the specified token quantity; it does not set a minimum economic return after the separate gas charge.
Network changes and target prices call for other tools
Cross-chain movement and waiting for a target price call for capabilities beyond choosing paths for an immediate same-chain swap. Network selection defines the liquidity a same-chain request can use. Multi-hop paths connect assets within that route; they do not establish a bridge transfer.
Changing the destination network
The swap widget supports same-chain and cross-chain swaps. A cross-chain quote needs its own bridge and execution terms; pool splitting alone cannot establish the destination-chain amount or arrival time. Solana Swap API access requires whitelisting and an authorized API key. Broad network coverage does not give every integration the same access to every route.
Waiting for a price condition
Limit orders address a target-price instruction on supported networks. Routing addresses path selection for a swap under quoted conditions. A better available path cannot substitute for an instruction to wait until a specified price. Choose the trading mechanism around that timing requirement before comparing its available execution paths.
Openocean routing FAQ
Does increasing slippage tolerance create more liquidity for a split route?
Increasing slippage tolerance changes the acceptable execution deviation, not the liquidity available to each route. A broader tolerance can permit a worse output within the transaction's bounds. It does not improve pool depth or establish an economic advantage from splitting. Compare the quoted route on its own terms before deciding which execution deviation to permit.
Is pool liquidity the only source available to the routing engine?
The aggregator also provides access to request-for-quote (RFQ) and private liquidity. Those sources broaden the available liquidity beyond exchange pools. Their inclusion does not establish that every quote uses them or that every network offers an identical mix. Assess the sources and paths represented in the particular quote rather than treating overall integration coverage as that route's composition.
How does V4 identify tokens when their symbols match?
V4 quote requests identify both sides of the swap through inTokenAddress and outTokenAddress on the selected chain. Matching symbols or displayed names do not establish identical assets. Token decimal metadata determines how the integration interprets each quantity before comparing output estimates for the intended swap pair.
When should an integration refresh a displayed routing quote?
For displayed V4 quotes, the recommended refresh interval is 10-15 seconds. That display interval does not establish a universal execution deadline. Changes to the selected assets, network, or input amount also require a quote for the revised request.
What determines the public Swap API trading fee for a split swap?
The public Swap API fee schedule classifies the traded pair by token category. Its categories are Stable, Correlated, Common, and Exotic. Treat the applicable trading fee as a separate cost input from gas expenditure, without subtracting it again if the output already includes it. Integrations can also configure referrerFee for integrator trading fees.
Will Permit2 eliminate the first token approval for a routed swap?
Permit2 still needs adequate token allowance before its signature-based swap flow can proceed. If allowance is insufficient, the token requires an approval authorizing Permit2. After that prerequisite, its SignatureTransfer flow uses an EIP-712 signature with an amount, deadline, and nonce. Routing across several liquidity sources does not remove the allowance prerequisite or authorize spending by itself.