Table of Contents
Do not index
Introduction
Fees are often treated as the main competitive parameter of an AMM. Protocols carefully tune fee tiers, and discussions about DEX competitiveness frequently focus on who charges less.
However, from a trader’s perspective the fee is only one part of the cost of executing a swap. What ultimately matters is the total execution cost.
Total Execution Cost
Total Execution Cost (TEC) is the cost a trader incurs when executing a swap through an AMM. In this article we focus only on the components that arise directly from the AMM mechanism itself. Other sources of loss such as front-running can increase trading costs, but they are not intrinsic to AMM design. They depend on the execution environment and are highly situational.
Execution costs are particularly important for retail order flow, especially in an ecosystem dominated by DEX aggregators. Aggregators systematically route trades to venues that provide the best execution. As a result, the structure of total execution cost largely determines where order flow goes.
Since retail flow is the main revenue source for most AMMs, understanding the structure of TEC is essential for protocol design.
Execution costs come from three sources with different economic origins:
- Gas cost — the gas consumed by the AMM contract to execute the swap.
- Liquidity provider fee — the fee charged to compensate LPs.
- Price impact — the cost arising from the AMM pricing curve.
For a trade of size V, we can think of total execution cost as:

Because trades can vary greatly in size, it is usually more informative to express costs relative to the trade value. In that case, TEC represents the percentage of value lost during execution rather than the absolute dollar amount.
Now let’s look at each component in more detail.
Gas
Gas is the cost of executing the swap transaction on-chain. Unlike the other components of execution cost, gas is mostly independent of trade size. A small trade and a large trade usually consume roughly the same amount of gas.
Because of that, gas matters most for small trades. As trade size increases, the gas cost becomes a smaller fraction of the trade value.
For a trade of size V, the relative cost of gas can be written as:

This means that as V grows, the relative gas cost approaches zero. In other words, gas becomes less important for large trades.
Gas also affects how DEX aggregators route trades. Aggregators often split large trades across multiple venues to reduce price impact. However, every additional swap increases gas consumption. If interacting with a venue is expensive in gas terms, it may be cheaper for the aggregator to accept slightly worse pricing elsewhere rather than route part of the trade through that venue.
Fees
The fee component is straightforward. Most AMMs charge a fee that is proportional to the trade size. If the fee rate is f, the fee paid on a trade of size V is:

This means that the relative cost of the fee is constant:

In other words, the fee always represents the same percentage of the trade value, regardless of how large the trade is.
Because of this property, fees tend to dominate medium-sized trades. For very small trades, gas usually represents a larger share of total execution cost. For very large trades, price impact becomes the main driver of execution losses.
Fees are also the easiest parameter for AMMs to adjust. Since every AMM includes a fee mechanism, changing the fee level is often the most direct way to compete for retail order flow.
Price Impact
Price impact is the cost that arises because a swap moves the price inside the AMM pool. Unlike gas or fees, it is not a fixed charge. It appears because trades consume liquidity and shift the pool price along the AMM curve.
For a constant-product AMM, the relative price-impact loss can be written as:

where V is the trade size and y represents the pool liquidity (measured in the output asset).
The important takeaway is that price impact depends on the ratio between trade size and liquidity.
For small trades (V ≪ y), price impact is very small and grows roughly proportionally to trade size.
However, as the trade becomes comparable to the pool liquidity, price impact increases rapidly. When the trade size approaches the scale of the pool, the execution price deteriorates quickly because the trade pushes the pool further along the pricing curve.
As a result, price impact becomes the dominant execution cost for large trades.
In concentrated-liquidity AMMs the effect depends on how liquidity is distributed across price ranges.
Liquidity is usually densest near the current market price. Small trades therefore interact with a deep liquidity region and experience very low price impact. As the trade size increases, the swap begins to move the price into ranges where liquidity is thinner.
In those regions, each additional unit of volume moves the price more than the previous one. As a result, price impact grows rapidly once trades exceed the main concentration of liquidity.
Price impact in AMMs is path-independent, so splitting a trade into several transactions cannot reduce the total price impact for a given volume. A smaller first swap moves the price less, but the next one starts from the new pool price created by the previous trade. The order therefore moves through the same segment of the liquidity curve. Fees still scale with total volume and gas is paid per transaction, so trade splitting cannot reduce TEC.
Realistic Execution Cost Scenario
To illustrate how execution costs arise in practice, consider swaps in a constant-product AMM with:
- $1M total liquidity ($500k in each token)
- 0.2% LP fee
- $0.02 gas cost per swap
Gas is modeled as a fixed cost expressed in dollar terms.
To make the analysis easier to interpret, trade size is expressed relative to pool liquidity:

where V is the swap notional and y is the quote-side liquidity in the pool (in this example, $500k). In a constant-product AMM, price impact primarily depends on this ratio.
The following charts illustrate how each component contributes to execution cost under these assumptions.
Press enter or click to view image in full size

Press enter or click to view image in full size

Two patterns are visible. First, the contribution of each cost component changes with trade size. Second, the total relative execution cost follows a characteristic curve: it falls quickly at first, stabilizes near the fee level, and eventually rises again due to price impact.
Under these assumptions we can identify three approximate execution regimes:
Small trades (~$100 or ~0.02% of pool liquidity).
Gas dominates the total execution cost. Because gas is a fixed transaction cost, it represents a large share of the value for very small swaps.
Medium trades (~$100–$5,000 or ~0.02–1% of pool liquidity).
The swap fee becomes the main cost component. Gas becomes negligible, while price impact remains small.
Large trades (>$5,000 or >1% of pool liquidity).
Price impact becomes the dominant source of execution cost as the trade begins to move the pool price more significantly.
While the exact thresholds depend on liquidity depth, fee level, and gas prices, the overall pattern is robust.
In concentrated-liquidity AMMs the threshold at which price impact dominates is usually higher, because liquidity is concentrated around the current price. In practice, price impact often becomes the main cost once the trade size approaches the scale of the pool liquidity.
Practical Implications for AMM Design
Execution cost ultimately determines which pools receive order flow. Because different trade sizes are sensitive to different components of total execution cost, AMM design should take these regimes into account.
Gas efficiency matters for small trades
For small swaps, execution cost is largely dominated by fixed gas costs. This situation is common on chains with relatively high transaction fees or in ecosystems with many small retail trades.
In this regime, pools with more gas-efficient contracts tend to receive more order flow, because even small differences in gas usage can noticeably change the total execution cost.
Fees determine the mid-size competitive range
Once gas costs become negligible relative to trade size, swap fees define the baseline execution cost.
If liquidity depth across pools is similar, aggregators will typically route trades to the venue with the lowest effective fee. As a result, fee levels often determine competitiveness for medium-sized swaps.
Liquidity depth dominates large trades
For larger trades, the dominant factor becomes price impact, which is determined by available liquidity.
Aggregators route trades toward pools that offer the lowest total execution cost. Pools with deeper liquidity can accommodate larger volumes with smaller price impact, so they tend to attract most large orders. Smaller pools may still receive small portions of the trade.
Important note: for this analysis initial AMM price was excluded, even if it too has an impact on trader choice of execution path. This decision is related to the unpredictable nature of this factor — it is connected with arbitrage activity, fee in each moment, external price trajectory. While important in practice, it is highly situational and therefore outside the scope of this simplified framework.
Conclusion
Execution quality in AMMs cannot be judged by fees alone. The relevant metric for traders and aggregators is total execution cost, which combines gas, swap fees, and price impact.
Each component dominates at different trade sizes. As order flow is increasingly routed by aggregators that optimize total execution cost, AMM competitiveness depends on optimizing the component that matters most for the trades a protocol aims to attract.
This framework provides a simple way to think about pool design, fee policies, and liquidity incentives.

