For the complete documentation index, see llms.txt. This page is also available as Markdown.

Price impact

How to calculate price impact?

Price impact means the variation rate between the prices of the two coins in actual transactions and the pre-calculated prices.

The SDK providers the sdk.Swap.calculateSwapPriceImpact method to calculated it.

Example

    const res = await sdk.RouterV2.getBestRouter(USDT, USDC, 100000000, true, 5, '', undefined, true, false)

    const priceImpact =  sdk.Swap.calculateSwapPriceImpact(res.result.splitPaths)
    console.log('priceImpact: ', priceImpact )

Last updated