Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Metric Docs | Estimate a Fill from Depth

Learn how liquidity depth can be used to estimate fill quality, price impact and available size before routing a Metric swap.

Learn how liquidity depth can be used to estimate fill quality, price impact and available size before routing a Metric swap.

Metric is built around Active Pools: liquidity pools that use a Price Provider to supply bid, ask and reference prices instead of relying only on reserve ratios. This page focuses on Estimate a Fill from Depth and the practical checks that matter when using or integrating the protocol.

Depth is size-dependent

A small order may execute near the best available quote while a larger order consumes more bins or liquidity ranges. Estimating fill requires the amount, direction and current depth.

Estimation steps

StepAction
1Fetch fresh depth for the intended pair
2Normalize token decimals and direction
3Walk available liquidity in execution order
4Compute weighted output and remaining size
5Apply transaction safety bounds before execution

Keep estimates fresh

Depth can change between estimation and submission. Treat the estimate as time-sensitive and protect the transaction with output constraints.

Last updated