Price Impact
Price impact is the change in token price caused by your trade, and is a closely related concept to slippage.
How Price Impact Works
Constant Product Formula
AMMs like gSwap use the constant product formula: x * y = k
x= amount of token A in the pooly= amount of token B in the poolk= constant that must be maintained
When you trade, you're changing the ratio of tokens in the pool, which changes the price.
Example: Price Impact Calculation
Starting pool state:
- 1,000 $GALA tokens
- 500 USDC tokens
- 1,000 * 500 = 500,000 (constant k)
- Current price: 0.5 USDC per $GALA
If you sell 100 $GALA you will receive ~45.5 USDC:
- Pool becomes: 1,100 $GALA, ~454.5 USDC
- 1,100 * ~454.5 = 500,000 (still same constant k)
- New price: ~0.413 USDC per $GALA
- Price impact: ~17.4% (the move of the pool price, from 0.5 to ~0.413; this is what
quote.priceImpactreports) - Your average execution price is 45.5 / 100 = ~0.455 USDC per $GALA, ~9.1% below the starting price
price impact
Factors Affecting Price Impact
Trade Size vs Pool Size
The ratio of your trade to the pool's liquidity determines impact. For a small trade into a 50/50
constant-product pool holding a total value TVL, the average execution price is worse than the
starting price by about 2 * trade / TVL, and the pool price ends about 4 * trade / TVL lower
(the figure quote.priceImpact reports):
Execution price vs start ≈ trade / (TVL / 2 + trade)
Pool price move ≈ 1 - (TVL / 2 / (TVL / 2 + trade))^2
Examples (one full-range 50/50 pool; a concentrated pool differs, so read the real figure off a quote):
- Trading $100 in a $1M pool: ~0.02% execution, ~0.04% pool price move
- Trading $100 in a $10K pool: ~2% execution, ~3.9% pool price move
- Trading $100 in a $1K pool: ~17% execution, ~31% pool price move
price impact
Pool Liquidity Distribution
In concentrated liquidity pools (like Uniswap V3/gSwap), liquidity isn't evenly distributed:
- Active Range: Liquidity concentrated around current price
- Out of Range: Less liquidity available at extreme prices
- Tick Density: How much liquidity exists at each price level
Fee Tier Selection
Different fee tiers often have different liquidity depths:
- 0.05% pools: Usually for very stable pairs, less liquidity
- 0.3% pools: Most common, good liquidity for many pairs
- 1.0% pools: Volatile pairs, may have concentrated liquidity
Minimizing Price Impact
When Trade Splitting Helps
Note: In a simple AMM with no other activity, splitting trades doesn't reduce total price impact - the cumulative effect is the same. However, splitting can help in these scenarios:
Allow Arbitrage Between Trades
By waiting between smaller trades, arbitrageurs can restore the pool price closer to external market prices:
import BigNumber from 'bignumber.js';
// Split trades with delays to allow arbitrage
const tradeSize = '100';
const numTrades = 10;
for (let i = 0; i < numTrades; i++) {
// Quote each slice fresh: the pool moves between slices, so the bound must move with it.
const quote = await gSwap.quoting.quoteExactInput('GALA|Unit|none|none', 'GUSDC|Unit|none|none', tradeSize);
const tx = await gSwap.swaps.swap('GALA|Unit|none|none', 'GUSDC|Unit|none|none', quote.feeTier, {
exactIn: tradeSize,
amountOutMinimum: new BigNumber(quote.amountOut).multipliedBy('0.99').toFixed(), // 1% tolerance
});
await tx.confirm();
// Wait for potential arbitrage to restore price
await new Promise((resolve) => setTimeout(resolve, 5000));
}
Benefit from Concentrated Liquidity Ranges
In concentrated liquidity pools, different price ranges have different liquidity depths. Smaller trades may stay within high-liquidity ranges:
- Large trade: May exhaust concentrated liquidity and move into sparse ranges
- Small trades: Each trade may complete within the concentrated range
Estimating Price Impact
Before Trading
Always get a recent quote to understand the expected price impact:
// For exact input (selling a specific amount) - automatically finds best pool
const quote = await gSwap.quoting.quoteExactInput(
'GALA|Unit|none|none',
'GUSDC|Unit|none|none',
'100',
);
console.log(`Best fee tier: ${quote.feeTier}`);
console.log(`Current price: ${quote.currentPrice.toString()}`);
console.log(`New price: ${quote.newPrice.toString()}`);
// priceImpact is negative for an adverse move (-0.01 is 1%), so print its size.
console.log(`Price impact: ${quote.priceImpact.abs().multipliedBy(100).toFixed(2)}%`);
console.log(`Expected output: ${quote.amountOut} USDC`);
Price Impact vs Slippage
Key Differences
| Aspect | Price Impact | Slippage |
|---|---|---|
| Cause | Your trade size | Market movement + your trade |
| Predictability | Calculable from pool state | Unpredictable |
| Control | Reduce by smaller trades or splitting across pools | Mitigate with tolerance settings |
Best Practices
Pre-Trade Analysis
- Check pool liquidity across different fee tiers
- Calculate expected price impact using quotes
- Consider trade splitting for large amounts
- Monitor market conditions and volatility
During Execution
- Use appropriate slippage protection accounting for price impact
- Monitor transaction status for unexpected failures
- Be prepared to adjust strategy if conditions change
Post-Trade Review
- Compare actual vs expected execution
- Analyze price impact accuracy from quotes
- Learn from results to improve future trading
Related Concepts
- Slippage - How market movement affects execution price
- Liquidity Concentration - Understanding pool depth and concentration
- Fees - How fees interact with liquidity provision
Price impact is a fundamental cost of trading on AMMs. Understanding and minimizing it through proper trade sizing and timing is crucial for efficient trading.