Please add API endpoints for current and historical prices of FA1.2 and FA2 tokens
Opened this issue · 5 comments
Please make it possible to get the current and historical prices of FA1.2 and FA2 tokens. e.g.
User holds 1000 Crunch and bought 20.02.22 at X price. And current price is XY.
So you can get individual token prices or aggregate prices over time and have price history etc.
With growing Tezos ecosystem this is a big piece thats missing in tzkt.
Thank you!
Hey! Thank you for the feedback! Having prices for Tezos tokens is definitely a great idea. We will consider adding current prices to TzKT. However, there are some doubts regarding historical prices, because the number of tokens is growing (there are already more than 2M tokens) and the number of blocks is growing, so storing historical prices for all tokens would be quite expensive for general-purpose indexer.
Hi I posted my feature request first on discord but Groxan told me there is this open github discussion, so I would like to add my "idea".
First regarding the mentioned doubts for historical prices, I think with my approach this can be limited?
When you only track the token contracts that have a pool on lets say quipuswap, the amount of tokens will get already limited for storing historical prices? But I am no expert and thinking out loud.
So for FA2 and FA1.2 tokens there is no endpoint to get historical price or "live" price.
The API endpoint should allow to query tokens using the contract address which is unique to a given token.
Knowing the contract address for youves uUSD
KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW
I should be able to query with TZKT and get the current prices
Now the question some might ask is "But there are more decentralised exchanges so there are different prices, how to do that?"
A very good example is how coingecko does it. They have a separate object for every exchange they gather/track the data.
I dont say tzkt api should track every dex. But for example the top 2-3?
then you would have something like this:
tickers:
{
Quipu:{
"base": "uUSD",
"target": "XTZ",
"lastprice": 1,
"volume": "157824452",
"bid_ask_spread_percentage": "0.2",
"timestamp": "2022-04-27T21:10:16+00:00",
"last_trade_at": "2022-04-26T21:10:16+00:00",
"trade_url": "quipuswap dot com/pair"
}
Spicy:{
"base": "uUSD",
"target": "XTZ",
"lastprice": 1,
"volume": "157824452",
"bid_ask_spread_percentage": "0.2",
"timestamp": "2022-04-27T21:10:16+00:00",
"last_trade_at": "2022-04-26T21:10:16+00:00",
"trade_url": "spicyswap dot com/pair"
}
}
Then people can easily get the data and build on top of it.
Since a year people are hoping for coingecko, cmc api but lets dont wait and integrate this for tzkt. 🙂
My example screenshot is taken from this example here.
https://api.coingecko.com/api/v3/coins/ethereum/contract/0x0d8775f648430679a709e98d2b0cb6250d2887ef
Do you plan o to add this feature to tzkt? @Groxan
@BearCooder definitely yes :) It just takes more time than we expected, because we have to spend a lot of time on constant protocol updates, which often contain breaking changes and backward incompatible behavior, so we have to do a lot of extra work :(
That makes sense, fingers crossed you can spend more time on it in the next week/months!