Fees & trade costs

Measure a buy-sell spread from executable quotes

Calculate a comparable buy-sell spread using matched token quantities and avoid combining unrelated trade sizes or timestamps.

To measure a size-specific buy-sell spread, obtain the cost of buying a fixed quantity and the proceeds from selling that same quantity under comparable conditions. A tiny purchase quote and a large sale quote do not define a meaningful matched spread.

Keep both directions in one unit

In a hypothetical market snapshot, buying 100 tokens costs 1,010 stablecoins and selling 100 tokens returns 990 stablecoins. The average ask is 10.10 stablecoins per token and the average bid is 9.90. Their midpoint is 10.00.

Spread relative to midpoint = (10.10 − 9.90) / 10.00 = 2%

The round-trip loss relative to the purchase outlay is instead (1,010 − 990) / 1,010, approximately 1.9802%. These figures use different denominators. Both can be correct when clearly labeled.

Quote size contributes to the spread

For an AMM, this calculation can contain fees and size-related impact in both directions. It is not necessarily a dealer's quoted spread or a pure fee measure. Uniswap distinguishes average execution prices from a pool's local mid price, which helps explain the difference.

Report separate network charges alongside the quote spread. Adding gas may be useful for a full round-trip budget, but that changes the metric from a token execution spread to a task-level economic cost.

A snapshot is not a sequential execution forecast

Two independent quotes can assume the same starting pool state. Executing the purchase changes that state before a subsequent sale. Other activity may also intervene. Consequently, the paired snapshot is a diagnostic of available pricing in both directions, not a guarantee of the exact proceeds of an actual immediate round trip.

Preserve quantities, direction, timestamp, fees and starting-state assumptions whenever the result is reported.

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

Estimate the cost of swapping out and immediately back Include the cost of leaving a position in a trade budget Why two pool fees do not always add to a single percentage