route_amm_swap
Compare multiple AMM pools for a DEX swap and return the venue that fills the most, along with a per-venue comparison.
Instructions
Best execution for a DEX swap across a set of AMM pools, exact to the wei. Give it the same notional and several venues (constant-product, Raydium CP, Uniswap v3) and it returns the venue that fills the most, the fill, and a per-venue comparison. Amounts are human 'NUMBER SYMBOL' strings (e.g. '50000 USDC'); each pool carries its token symbols and decimals, so directions are by symbol and a mis-routed swap raises instead of returning a quiet zero. Requires the optional flox-py dependency.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| venues | Yes | Pool specs. Each: {venue, token0:{symbol,decimals}, token1:{symbol,decimals}, ... venue params}. constant_product/uniswap_v2: reserves (['1000 WETH','2000000 USDC']), fee, fee_den. raydium_cp: reserves, trade_fee. uniswap_v3: sqrt_price_x96, liquidity, fee, ticks. | |
| amount | Yes | Input amount as 'NUMBER SYMBOL', e.g. '50000 USDC'. | |
| into | No | Out-token symbol (optional; inferred otherwise). |