WatchData Price API and how it works?

Easily get accurate prices for cryptocurrencies: WatchData Introduces the WatchData Price API

We at WatchData know how dApp developers sometimes need accurate token prices when creating decentralized apps. WatchData users know that WatchData takes dApp development to the next level with its powerful yet easy-to-use backend infrastructure. That’s why we’re now bringing WatchData functionality to token pricing on the blockchain with the WatchData Price API!

What is Price API

When you work with data from blockchain you can get all kinds of information, for example you can check logs with eth_getLogs or if you want you can get the transfers of the token you’re interested in with watch_getTransfersByAddress. But if you need data in the form of prices for your fiat currency, you simply can’t find this data in the blockchain. That is, you will get a lot of useful information, but if you need to put it into a price format, you will have to do extra work.

It is a convenient API with which you can get rates for more than 2 000 pairs, both for cryptocurrencies and fiat assets. Sound interesting? Next we will tell you how to interact with our API and get this data.

How and what data can I get?

First, you have to go through the registration steps in our app. You can read a short guide here: link to the guide, or watch a video here: link to YouTube.

Once you’ve registered, you need to create your key. You can create a key for any blockchain to interact with Price API, it won’t play a role when interacting with API.

The only thing left is to make requests and get the data we need. To do that let’s open Postman and insert our key.

Your url should look like this:

https://price.api.watchdata.io/price/current_price?api_key=your_api_key

Then let’s write a simple query for any pair. For example take DOGE to EUR.

Request example:

{
    "base_symbol": "DOGE",
    "quote_symbol": "EUR"
}

The API worked out the result. Let’s take a look at it

Response example:

{
    "base_symbol": "DOGE",
    "quote_symbol": "EUR",
    "price": 0.1207,
    "created_at": "2022-05-06T07:36:54+00:00"
}

From the result, we see that 1 DOGE is offered for 0,1207 EUR as of 05/06/2022. Let’s check if this value is correct. Let’s go to Coinmarketcap, Binance and Coingecko to check Dogecoin value to Euro.

  1. Coinmarketcap

2) Binance

3) Coingecko

As you can see from the screenshot, the price € 0.120…, it differs by a few thousand cents, but this difference is explained by the time spent on searching on the above resources.

You can check hundreds of different pairs and take their actual rates through our API.

Let’s try to get the reverse rate of EUR to DOGE. To do that we just need to swap tickers and make a new request:

Request example:

{
    "base_symbol": "EUR",
    "quote_symbol": "DOGE"
}

Response example:

{
    "base_symbol": "EUR",
    "quote_symbol": "DOGE",
    "price": 8.285004142502071,
    "created_at": "2022-05-06T08:27:08+00:00"
}

Great! We were able to get the reverse rate. From the obtained values, we see that at the time of the request, we can get 8.28 DOGE for 1 EUR.

If you’re building a Web3 application or a dApp that uses token prices, using the WatchData Price API is a must.

The API brings crucial functionality to a wide range of cryptocurrency projects. This includes creating NFT projects, cryptocurrency wallets, various DeFi applications, or any type of dApps that require reliable price information. The ability to get accurate information about the price of almost any token cannot be overstated.

Last updated