Skip to content

What is the best way to get the USD price of a token #2424

Answered by htadashi
rafaelfaria asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @rafaelfaria, it seems that you are calculating the USD price of a token within a PancakeSwap-like pool. I think what you did is a suitable way to calculate it since you are getting the real execution price of the trade. However, keep in mind that the price obtained may be different from the "real" market price in a CEX, since the price of a pool could be easily manipulated if it has low liquidity. This video should give you more insights about it.

P.S.: I think this type of question would be better suited (and more promptly answered) in Ethereum Stack Exchange since it is not related to ethers.js :)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@rafaelfaria
Comment options

Answer selected by rafaelfaria
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants