Define the average-price comparison
Effective input is dx × (1 − f), and output is dy = y × effective input ÷ (x + effective input). Average price paid is dx ÷ dy in input tokens per output token. Starting price is x ÷ y. Impact is (average price ÷ starting price − 1) × 100. Because average price uses full input, the reported impact includes the fee; it is not a fee-free curve-only measure.
Calculate a hypothetical trade
With reserves of 100 and 20,000, input of 1, and a 0.30% fee, output is approximately 197.4316. Starting price is 0.005 input tokens per output token; average price is about 0.00506505. Reported impact is therefore about 1.301%. Post-trade reserves are 101 and 19,802.5684. Their ratio is a new marginal reserve price, which differs from the average price across the whole trade.
Avoid reciprocal and fee confusion
Reversing token direction requires reversing reserves and redefining which token is input. A percentage computed from output per input will differ from one computed from its reciprocal. The post-trade input reserve includes the full input amount, not only the fee-adjusted amount. Gas and other external fees are excluded. At zero input, output is zero and average execution price is undefined; a tiny positive trade still carries the modeled fee contribution.