dex.liquidity_slippage
Estimate DEX pool liquidity and trade slippage for any trade size. Check total USD liquidity, 24h volume, and slippage tiers to compare pools before swapping.
Instructions
Estimate DEX pool liquidity and trade slippage (GeckoTerminal): total USD
liquidity, 24h volume, an estimated slippage percentage for the given
trade size, and slippage_tiers at fixed $1k/$5k/$10k sizes. Approximated
under a documented constant-product (50:50) assumption since GeckoTerminal's
free API exposes only combined USD liquidity, not per-token reserves.
Also returns quote_token_is_stablecoin (false/null means this pool isn't
USD-quoted - an extra hop is needed to reach USD, not accounted for here),
pool_fee_pct (the pool's swap fee tier, disclosed for reference only - not
subtracted from the slippage estimate), and assumed_gas_cost_usd (a flat
per-network estimate, not a live quote).
Use this before sizing a trade or comparing pools for a given token, to
check depth before swapping. Do NOT treat estimated_slippage_pct or
slippage_tiers as an exact on-chain quote, especially for concentrated-
liquidity or stableswap pools - always re-verify with a live quote before
executing. Requires exactly one of pool_address or token_address; passing
neither raises an "invalid_input" error.
Args:
trade_size_usd: Hypothetical trade size in USD.
network: GeckoTerminal network id, e.g. "base", "eth" (default "base").
pool_address: A specific pool contract address.
token_address: Token contract address (auto-picks the most liquid pool).
One of pool_address or token_address is required.
Returns:
On success: {"success": true, "total_liquidity_usd",
"estimated_slippage_pct", "slippage_tiers", ...}
On failure: {"success": false, "error": {"type", "message"}}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | base | |
| pool_address | No | ||
| token_address | No | ||
| trade_size_usd | Yes |