Replies: 1 comment 1 reply
-
i think you can simulate the swap tx, that will give you the most accurate output https://aptos.dev/en/build/sdks/ts-sdk/building-transactions/simulating-transactions |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Discord user ID
No response
Describe your question in detail.
I have a question about liquidity pools. How can I get the actual exchange rate? I check the ratio in the pool, but when I look at the exchange UI, I see a different amount. The contract doesn't have functions to get the final amount for the token swap.
What should I do in this case?
I want to write a function that accurately calculates how much I will receive for the swap, rather than just executing the trade blindly.
I know how to calculate the ratio in the pool, I haven’t tried it yet but I understand that transaction simulation can be used, but is there a solution for this? Or is simulation the solution itself?
Today, I checked a swap, and the pool information showed 6.15 USD, but in the UI, I saw 6.13 USD. How does this happen?
I set the slippage to 0%, does price impact affect this? But the amount is just 1 dollar, not a large sum.
Can anyone help, please?
Any examples makes me happy! Thank you!
What error, if any, are you getting?
No response
What have you tried or looked at? Or how can we reproduce the error?
No response
Which operating system are you using?
macOS
Which SDK or tool are you using? (if any)
Python SDK
Describe your environment or tooling in detail
No response
Beta Was this translation helpful? Give feedback.
All reactions