What Is Price Impact in a DEX Swap? Pool Depth and Math

What Is Price Impact in a DEX Swap? Pool Depth and Math


Price impact in a DEX swap is the worsening of your average fill price as your trade changes a pool’s reserves; in a constant-product pool, it grows with trade size relative to the input-side reserve.

You meet price impact when a swap quote offers fewer output tokens per input token than the pool’s current spot price suggests. The constant-product pools at Fraxswap are a concrete case: each unit sold changes the reserves used to price the next unit. The difference comes from the trade itself, before fees or wider market moves.

How Do Pool Reserves Set Price Impact?

Pool reserves set price impact through the constant-product rule, x*y=k, also used by a Uniswap v2-style pool. A swap adds the token you sell and removes the token you buy while keeping the product of the reserves constant before fees. As the reserves shift, the rate available for the next unit changes.

  • x is the reserve of the token you put in.
  • y is the reserve of the token you take out.
  • dx is your input amount; dy is your output before fees.

The pool starts at a spot rate of y/x output tokens per input token. Adding dx moves its reserves to x+dx and y−dy. Keeping their product at k gives dy = y*dx/(x+dx). Divide that output by dx and your average fill rate is y/(x+dx), below the starting spot rate. Each successive input unit receives less output because the pool holds more of what you are selling and less of what you are buying.

Say you sell 10 ETH into a pool holding 1,000 ETH and 2,000,000 USDC. The starting spot rate is 2,000 USDC per ETH, which would imply 20,000 USDC for 10 ETH at an unchanged rate. The formula instead returns about 19,802 USDC before fees. Your average rate is about 1,980.20 USDC per ETH, or 0.99% below the starting spot rate.

For this measure of average-fill impact, the calculation simplifies to dx/(x+dx), expressed as a percentage. The key input is dx/x: your trade relative to the reserve of the token you sell. A 10 ETH sale uses 1% of a 1,000 ETH reserve, producing roughly 1% impact. The pool’s spot price after the swap falls by about 1.97%, a different number because it describes the rate for the next trade rather than the average rate you received.

Pool depth changes that comparison directly. Double both reserves to 2,000 ETH and 4,000,000 USDC, keeping the same 2,000 USDC spot rate, and the same 10 ETH sale has about 0.50% impact before fees. Doubling depth roughly halves impact when the trade is small relative to reserves. Looking at the spot rate alone misses this: two pools can quote the same spot price yet fill the same order at different average prices.

For a large order, Fraxswap’s time-weighted automated market maker, or TWAMM, executes pieces over time. After one piece pushes the pool price away from other markets, arbitrage traders may trade against that difference, partly restoring the reserves before later pieces execute. That can improve the average fill compared with sending the whole order at once; the result depends on arbitrage activity and market prices during execution.

Price Impact vs Slippage Tolerance?

Price impact measures how the trade changes the pool’s price and average fill at the quoted reserves. Slippage tolerance sets how much worse the execution may be than the quote by the time the transaction runs. A quoted swap can already have substantial price impact even when execution matches its quote exactly. Set tolerance for possible changes between quoting and execution; it does not remove the impact built into the quote.

Why Is Price Impact High in Small Pools?

Price impact is high in a small pool because the same trade consumes a larger share of its input-side reserve. With only 500 ETH at the same spot rate, a 10 ETH sale has about 1.96% average-fill impact before fees. Compare your input with that reserve, then use dx/(x+dx) to judge whether the quoted impact warrants a deeper pool or execution over time.

Report Page