raydium-sdk-swap-example-typescript
raydium-sdk-swap-example-typescript copied to clipboard
The calculated exchange amount is sometimes small
- sol swap usdc, 0.02 WSOL -> 0.38 (It should be 2.x)
- slippage 5%
- mainnet tx: FVGsLj53u5sGKpDZYePZPiUV23SqGCQrVDYYM1cj1auSRcBENKAsotdhJgpXugawrZZxRttt5KS1tG3bU3BCuFo
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%