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
| Step | Action |
|---|---|
| 1 | Fetch fresh depth for the intended pair |
| 2 | Normalize token decimals and direction |
| 3 | Walk available liquidity in execution order |
| 4 | Compute weighted output and remaining size |
| 5 | Apply 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.
Related Metric Docs
Last updated