Price Impact Calculation

How priceImpactPct is calculated within /quote

Using 10 USDC as a reference, we compute the amount of each token for every single token currently listed in /quote.

This provides a reference price for all assets.

Based on /quote for the specific routing, with inAmount and outAmount for an inputMint and outputMint, we calculate a price from this in/out ratio (Quoted Price).

The price impact is then calculated as follows: