raydium-sdk-swap-example-typescript icon indicating copy to clipboard operation
raydium-sdk-swap-example-typescript copied to clipboard

The calculated exchange amount is sometimes small

Open jsmzr opened this issue 1 year ago • 0 comments

Should I also check the price and get a new pool info if it differs too much from expectations

Log at exception time, Liquidity.computeAmountOut

[DEBUG] slippage: 5%
[DEBUG] input side: base
[DEBUG] currentPrice: 1 UNKNOWN ≈ 146.953173 UNKNOWN
[DEBUG] currentPrice invert: 1 UNKNOWN ≈ 0.006804889 UNKNOWN
[DEBUG] amountOut: 0.418642
[DEBUG] minAmountOut: 0.398706
[DEBUG] executionPrice: 1 UNKNOWN ≈ 20.984561 UNKNOWN
[DEBUG] executionPrice invert: 1 UNKNOWN ≈ 0.047654082 UNKNOWN
[DEBUG] priceImpact: 85.72%

Normal time logs, Liquidity.computeAmountOut

[DEBUG] slippage: 5%
[DEBUG] input side: base
[DEBUG] currentPrice: 1 UNKNOWN ≈ 147.345628 UNKNOWN
[DEBUG] currentPrice invert: 1 UNKNOWN ≈ 0.006786764 UNKNOWN
[DEBUG] amountOut: 2.927112
[DEBUG] minAmountOut: 2.787725
[DEBUG] executionPrice: 1 UNKNOWN ≈ 146.722406 UNKNOWN
[DEBUG] executionPrice invert: 1 UNKNOWN ≈ 0.006815592 UNKNOWN
[DEBUG] priceImpact: 0.42297%

jsmzr avatar May 04 '24 11:05 jsmzr