Via API
1. Discover Available Pools
Query the metadata endpoint to retrieve:
- Supported trading pairs
- Pool addresses
- Quoter and token addresses
Route only to pools whose priceProviderStatus is healthy and whose pauseLevel is 0.
***
2. Fetch Current Bid / Ask and Depth
Request the current bid and ask prices for up to 100 pools on one chain in a single POST /public/v1/evm/{chain_id}/bid_ask/batch call. No key is needed; a Trading API key raises the rate limit.
- Each pool gets the same quote as the single-pool bid / ask endpoint, or an
errorif that pool can't be quoted - Depth is returned in addition to prices (pass
"depth": falseto skip it). Use it to estimate what an order fills for - Returned prices are already normalized for use with Relatick’s contracts
Check each side's price, not only priceProviderStatus: a pool can refuse one direction while staying healthy, and that side then carries the unavailable sentinel. This check needs depth, so keep it on if you rely on it.
***
3. Size the Trade
Pick one:
- Your own routing: walk each pool's depth for your order size, as described in Estimate a fill from depth.
- Relatick's routing: call Find best route. It uses depth to plan direct and one-hop routes, can split an order, and prices the selected paths with pool snapshots when available. Pass
poolAddressto size the trade against a single pool.
Depth-based estimates can differ from the amounts returned by Find best route.
***
On Ethereum: quote and simulate with the latest update
On Ethereum, many pools are priced by market-maker updates that go onchain only in a block that contains a trade against the pool (see Freshness and ordering). Between trades, the onchain price can be old. An eth_call of MetricOmmSwapQuoter, or a simulation of your swap, at the latest block can then revert with FeedStalled or return an outdated amount, even when the API shows the pool as quotable.
The API's bid, ask and depth come from the latest streamed update. To quote or simulate onchain at that same price:
- 1.Get the pool's latest
stateOverridefrom Titan's propAMM streams (pamm_quote_stream_v2ortitan_getPammVenues). - 2.Pass it to your
eth_callofMetricOmmSwapQuoteror toeth_simulateV1. - 3.Send the transaction through a participating builder, so the update is placed before your trade. Keep a fallback route in case it isn't.
For endpoints, API keys and bundle options, see Via Titan propAMM streams.
***
4. Execute the Trade
Use the Router's exactInput* / exactOutput* entrypoints, or call swap on the pool.
- Supports both exact-input and exact-output swaps
- Uses the same Q64 price format for bid, ask, and price limits
- Price limits protect execution against excessive slippage
Depth is an estimate. Set your protection from it:
- Exact input:
amountOutMinimum = estimatedOut × (1 − slippageTolerance) - Exact output:
amountInMaximum = estimatedIn × (1 + slippageTolerance)
For the exact amount, quote with MetricOmmSwapQuoter before sending. Pools with extensions can refuse a trade that depth shows as fillable. To catch this, simulate the transaction with your real from address (see Why a swap reverts). On Ethereum, apply the pool's latest update to both calls first; see On Ethereum above.
Last updated 29 days ago
Relatick