Api for price

Is there an api for incognito price?

@inccry

curl https://api.incscan.io/pdex/market | jq -r '.lastPRVPrice'

10 Likes

Are there in the meantime more ways to request the PRV price via API?

Hi @binh, do we have any PRV price API to share with the public?

1 Like

This would be great, I want to build small tool and need the live PRV price for this. Would be important, that if the data is submitted via JSON that the price comes as double not as a string :slight_smile:

Hey @sato,

You may use this address: https://api.incognito.org/ptoken/list

From that address, you may get the price of any currency listed in pDEX in terms of Prv (PricePrv attribute). For incscan-style, you should get pUSDT/pUSDC prices and average the reverse of them.

Or you may use my brand-new Python SDK: abduraman - Python API for Incognito SDK . There is a Incognito.Public.getTokenList() method which does the same.

There are some other methods to get/calculate the price but this is the easiest one.

2 Likes

Thank you so much @abduraman. This was exactly what I was looking for during the last days. You really made my day. Again thanks a lot, for the link.

1 Like

Hi, this API get prices from where ? Is it possible to read prices from fullnode ?

https://api.coingecko.com/api/v3/simple/price?ids=privacy&vs_currencies=USD

You can change the url. Specifically the end (ā€œUSDā€) to any of the supported base currencies of your choice.

1 Like

Hi @pfrp,

Use getpdestate to get liquidity pools current status so you can recalculate current price. Thatā€™s what I use to get last PRV price on Incscan.

PRV price in USD on Incscan : average of PRV price on [PRV-pUSDT,PRV-pUSDC,PRV-pDAI]

1 Like

Thanks, inccry

@abduraman , is there documentation for api.incognito.org?
If I open api.incognito.org on Brave, it doesnā€™t resolve to anything. Is there a page on that site for docs/help?
(ā€¦ Nevermind, I can just run api.incognito.org/ptoken/list through python to get the results I want).
ā€¦ However this will just give the current price on all assets.
Is there a known way to query historical prices?
ā€¦ I want to build a price database, not working on a smart contract.

Also I noticed that you havenā€™t updated your python library since Dec 2020.
Have you discontinued that proj after that unfortunate run-in you had on the SDK thread?

Iā€™m just looking for an API for PRV (not an Oracle).

Unless the team has any cached option, your only option is to use on-chain data.

After then, Incognito got many updates especially on pDEX. Those updates require so much time which I havenā€™t and besides, unfortunately I have health problems. So, yes, I cannot continue the project.

Very interesting concept for meā€¦ Especially since I may be interested in building a complete price database of more than 1 asset not avail on most APIsā€¦ & historical prices are gonna be even more difficult to get listings for.

So, when reading a blockchain, I would be looking for DEX swap events.
Is it even possible to read a blockchain via Python? Would I need to use a smart contract language? Iā€™ve obv done programming, but never previously had a blockchain project.

Iā€™ll do some searching about how to parse a blockchain & go from thereā€¦

Not for whole blockchain events but for price manipulation events. You may use liquidity amounts and/or swap events.

You may use any language. My Python SDK is just a wrapper for RPC messages. In other words, you will query blockchain by RPC messages.

Or there is a command line tool in the repo: incognito-cli. You may also check it out.