price_amm_swap
Price a DEX swap against an AMM pool to quote fill cost or measure price impact. Supports constant-product, Raydium CP, and Uniswap v3 pools using on-chain state.
Instructions
Price a DEX swap against an AMM pool, exact to the wei, through FLOX's integer curves. Use this to quote a fill or measure price impact on a constant-product (Uniswap v2), Raydium CP (Solana), or Uniswap v3 concentrated-liquidity pool from its on-chain state. Amounts are decimal strings (native wei / lamports), so 256-bit values are lossless. Requires the optional flox-py dependency.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| venue | Yes | The pool's AMM type. | |
| pool | Yes | Pool parameters as decimal strings. constant_product: reserve0, reserve1, fee_num, fee_den. raydium_cp: reserve0, reserve1, trade_fee_rate. uniswap_v3: sqrt_price_x96, liquidity, fee_pips, ticks (optional [sqrtRatio, net] pairs). | |
| amount_in | Yes | Input amount, native wei (decimal string). | |
| i | No | In-token index (default 0). | |
| j | No | Out-token index (default 1). |