0

In the web application I am working on , I need to find the current price of an ERC20 token listed on etherscan . How can this be done using code or some etherscan api ? Any help is appreciated.

  • Please mark my ans as solved. If its resolved your problem. – Jitendra Kumar. Balla Feb 12 '18 at 10:39
  • Will do..give me some time – Webdev Feb 12 '18 at 10:44
2

To be honest it depends on exchanges. Different exchanges will have different trade value and It depending on demand. Unfortunately there is no common value for token. Usually there will be 1-5 some times 15% price different because it depending on country/exchange/local law/exchange commission etc..,

Yes there will be api is available. Refer below link's

https://api.coinmarketcap.com/v1/ticker/

https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=EOS,USD,EUR

0

For ERC-20 tokens, I assume you are looking for example how to find the market price of Basic Attention Token (BAT), an ERC-20 token deployed on Ethereum.

My suggestion is to try the Crypto API from CoinGecko

Reason being that, token names/symbols are tricky. There can be many "BAT" symbol tokens and say you don't want the hassle of maintaining a mapping of ids.

The CoinGecko API allows you to query token using contract address which is unique to a given token

Knowing the contract address for Basic Attention Token 0x0d8775f648430679a709e98d2b0cb6250d2887ef

You can query it with https://api.coingecko.com/api/v3/coins/ethereum/contract/0x0d8775f648430679a709e98d2b0cb6250d2887ef

As long as you know the ERC-20 contract address, you can query almost any market data so long its supported on CoinGecko in which it is quite likely the case.

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.