2

Take this whale wallet for example:

https://etherscan.io/tokenholdings?a=0xa929022c9107643515f5c777ce9a910f0d1e490c

If you look at the top right, it says Value in USD.

enter image description here

Is there any any API that can help me derive this USD value irrespective of what all ERC20 tokens are in wallet?

APIs so far either need a contract address or return eth valuation

PS:

  • m trying to fetch all this using python's requests library
  • sorry for wrong tags if any
1
  • did you get the answer?
    – Farhan Ali
    Aug 28 at 17:27

1 Answer 1

1

Okay, I had a quick look at a dumb (scraping-based) answer to this, but gave up. So this answer is more of an idea of what not to do, or what to take further.


Given you're already using Python, you could have gone one step further and scraped that page with BeautifulSoup. (pip install beautifulsoup4)

However, Etherscan is protected by Cloudflare, so you can't just scrape the page directly. What you can do is use a package such as Cloudscraper. (pip install cloudscraper -U)

However, the page you're looking at is also dynamically generated, so you can't just scrape the HTML. What you can do is use a browser driver such as Selenium to programatically create the page and grab the data. (pip install selenium)

But then... it'd probably be quicker to find an appropriate API! (Caution: I've noticed different chain explorers will index tokens slightly differently, as well as use different sources for prices. You're unlikely to find a different explorer with exactly the same overall price as Etherscan.)

2
  • any other way? using api?
    – Farhan Ali
    Aug 28 at 17:27
  • It's not part of the Etherscan API unfortunately (docs.etherscan.io/api-endpoints/accounts). The issue is that different platforms/exchanges will treat certain tokens differently. If the market for a given token isn't big enough, they will consider the token to have no value. So really you need to understand the different markets for a given token, and then work out the net worth of an address. Difficult and subjective! Aug 28 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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