block-quote On this pagechevron-down
GitBook Assistant Ask chevron-down Swap Types Overview Understanding the four swap routing strategies
DexAggregator automatically detects and implements the optimal swap type based on liquidity distribution and routing efficiency. Understanding these types helps you interpret the routing logic and optimize your integrations.
The Four Swap Types
Type
Structure
Use Case
Complexity
Direct swap via single DEX
Multiple DEXes in parallel
Split liquidity for better rates
Sequential swaps through tokens
Parallel routes with internal hops
Complex routing optimization
Quick Comparison
Copy WBNB ─────[PancakeSwapV3]────→ USDT
(100% of liquidity) When used: Direct pool exists with sufficient liquidity
Copy WBNB ─────[PancakeSwapV3 60%]────→ USDT
└────[UniswapV2 40%]─────────┘ When used: Multiple pools offer competitive rates
When used: No direct TokenA-USDT pool exists
Parallel Multi-Hop
When used: Complex routing through multiple intermediate paths
Automatic Detection
The API automatically selects the optimal swap type:
Analyze Route Structure - Examine KyberSwap's routing recommendation
Calculate Split Ratios - Determine liquidity distribution
Select Swap Type - Choose the most efficient encoding
Generate Calldata - Encode parameters for smart contract
Detection Logic
Response Field: swapType
Every response includes the detected swap type:
Gas Costs by Type
Swap Type
Typical Gas
Description
Scales with number of splits
Most complex, highest gas
Choosing Swap Types
When Simple is Best
✅ Direct liquidity pool exists
✅ Single pool has sufficient depth
✅ Lowest gas cost priority
When Batch is Better
✅ Multiple competitive price sources
✅ Price improvement > gas cost
When Multi-Hop is Needed
✅ No direct pool available
✅ Intermediate token has deep liquidity
✅ Common routing pattern (e.g., via WETH)
When Parallel Multi-Hop Wins
✅ Very large swap amounts
✅ Single path has insufficient depth
✅ Multiple intermediate routing options
Examples by Token Pair
Popular Pairs (Simple/Batch)
Exotic Pairs (Multi-Hop)
Large Amounts (Parallel Multi-Hop)
Route Visualization
The routeInfo field provides detailed routing breakdown:
Understanding Percentages
In Batch and Parallel Multi-Hop swaps, percentages indicate liquidity split:
The smart contract handles the splitting automatically based on executorData.
circle-check
Optimization Tips
Don't force swap types - Let the API choose automatically
Monitor gas costs - Complex types may not justify price improvement
Set appropriate slippage - Multi-hop swaps may have higher slippage
Test exotic pairs - Understand routing before large swaps
circle-exclamation
Important Notes
Swap type is determined by KyberSwap's routing algorithm
Custom routes allow manual swap type selection
More complex types don't always mean better rates
Gas costs scale with routing complexity
Deep Dive Pages
Learn more about each swap type:
Last updated 3 months ago