Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset price can be off #5

Open
vinamogit opened this issue Apr 16, 2022 · 0 comments
Open

Asset price can be off #5

vinamogit opened this issue Apr 16, 2022 · 0 comments

Comments

@vinamogit
Copy link

vinamogit commented Apr 16, 2022

Hi,

I can see that some prices for a given asset can be "wrong" somehow.
I've encountered this problem myself and would like to share it with you.

When you try to query for a price, the accuracy of the result price depends greatly from the available liquidity.
Typical example is with BTC, if you want to estimate the price and you query a path payment (or other method) for 1 BTC you may have a result far below what you could get for your actual balance if you have 0.001 BTC for example.

I've ended up with the following method:
if
balance > 1
then
query the price with base 1
else
query the balance amount

There are still some caveats with this method, hopefully you will find a better solution.
So, what I found the most reliable was to use tradeAggregation average.

Best regards,
Vincent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant