Subtract the smaller quote's output from the larger quote's output, then divide by the extra input. The result is the average execution rate of the added interval, provided the quotes use comparable state and conditions.
Calculate the added portion
Suppose hypothetical input of 1,000 returns 990 tokens and input of 1,200 returns 1,178. The larger trade adds 200 input and 188 output, so the additional interval has a rate of 0.94 output per input.
The whole 1,200 trade averages approximately 0.981667. The added portion is materially worse than that average. This explains why a seemingly modest change to a large order can carry a disproportionate execution cost.
An interval is not an infinitesimal derivative
The 0.94 result averages the next 200 units. It is not necessarily the rate of the very next smallest unit. A narrower quote interval can approximate the local slope more closely, but rounding, route changes and timing noise can dominate very small differences.
The distinction between local and average execution prices is relevant here. Label the calculation an incremental interval rate unless you have justified a marginal approximation.
Check comparable routes and states
If the larger quote changes route, the difference includes the consequences of that route choice. It is still useful as a comparison of offered outcomes, but it no longer measures just one pool's next segment.
If the observations use different states, subtracting them can produce a misleading incremental rate or even an apparent anomaly. Preserve timestamps and repeat the matched comparison before attributing a jump to depth.
Use the calculation to understand which portion drives cost. It does not imply that executing the smaller trade now makes the remainder available at an independent fresh-state quote. Sequential execution needs the actual post-trade state.
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.
- Pricing with the v2 SDK
Distinction between mid price and average execution price.
https://developers.uniswap.org/docs/sdks/v2/guides/pricing