1

The thing is that I need to calculate the price of a tokan in sol or in usd. I would use one of the publicly available APIs, such as birdeye or jupiter, but they do not display the price of tokens that have not yet launched by open_time. I have all the information about the token such as metadata and liquidity pools from raydium.enter image description here

2 Answers 2

0

I had the pool address so I just streamed the recent transactions in the pool and found the swap ratio to get the price.

2
  • how do you use the swap ratio to calculate the price? is it simply just taking the tokenA/tokenB * tokenB price?
    – Sewy
    Commented Apr 19 at 6:09
  • Message me on telegram can explain bit more complex than that. @Amayp1
    – amayp1
    Commented Apr 20 at 8:30
0

To get the current value per (base) token in it's respective (quote) token, you would do something like:

Get the pool baseVault and pool quoteVault, they are just ATAs so you would call getParsedAccount on each and get their amounts (use the non-ui raw amount) and then divide the quoteVault amount by the baseVault amount, which would equal the current price.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.