0

Is there a way to query the price of a pair that's on a dex independent of the dex? For example: MIN/ADA or others? I am trying to see how the data in the cexplorer database could be used to do this.

3
  • 1
    cardano-db-sync does not track native asset prices. Jun 14 at 21:14
  • I do understand cardano-db-sync does not track prices of anything per-se, but I was asking if there is a method for extracting that information given the data available in cexplorer - i.e. a way of doing it yourself, not a way cardano-db-sync does it for you :| Jun 15 at 3:55
  • I would be surprised if all of the data you need is even in db-sync. Jun 16 at 5:16

1 Answer 1

-1

This can be done. I used to do it via the client. One can index the current price by looking at the script address of the dex and filtering the native asset to get the utxo that represents the liquidity pool. From that you can deduce the price by just dividing, price = native asset amount in pool / ada amount in pool. I used a bash script to watch this price together with awk, something like

watch -n 1 'cardano cli query address $(cat addresOfDex) | awk \'*filter for line that contains native asset or pool id*\' | awk \'*devide the correct things*\'

Note that I ommitted the filters as I do not remember them. Db-sync can do something similar of course.

1
  • Thank you for the guidance to a possible solution! Jun 15 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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