Liquidity & price impact

The average fill price is not the pool's ending price

Calculate average swap execution and the pool’s ending marginal price from one reserve change, showing why they differ.

The average execution price summarizes all units exchanged during the swap. The ending marginal price describes the pool immediately afterward for an additional very small trade, before fees. They should not be used interchangeably.

One fee-free example

Start with hypothetical reserves of 10,000 input tokens and 10,000 output tokens. Add 1,000 input tokens. A constant-product calculation returns approximately 909.090909 output tokens.

The average output rate is 909.090909 / 1,000 = 0.909091 output tokens per input token. Ending reserves are 11,000 input and approximately 9,090.909091 output. The ending marginal output rate is 9,090.909091 / 11,000 = 0.826446.

MeasureOutput per input
Initial marginal rate1.000000
Average fill rate0.909091
Ending marginal rate0.826446

Explain the difference

Earlier units traded while the pool was closer to its initial state. Later units encountered a less favorable rate. The average lies between the starting and ending local rates in this simple monotonic example.

Uniswap's pricing guide defines execution price using sent and received amounts, while the local price reflects reserves. The example excludes fees so that the two concepts are easy to separate.

Choose the measure your limit describes

If a liquidity report says “depth within 1%,” ask whether it limits average execution shortfall or the final marginal price movement. The available size can differ substantially.

Also keep the price direction explicit. Input per output is the reciprocal of output per input; a 10% decrease in one orientation is not a 10% increase in the other. Record quantities first, then calculate the intended measure instead of comparing unlabeled percentages.

Sources & verification (1)

Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.

  1. Pricing with the v2 SDK

    Distinction between mid price and average execution price.

    https://developers.uniswap.org/docs/sdks/v2/guides/pricing

Continue reading

Find a maximum trade size for a stated price-impact budget Measure liquidity within a one-percent price band Relate swap size to the reserve you are adding to