External API – Getting ETH Price with Ethplorer API

external-api

Simple question:
It seems like ethplorer doesn't expose the ETH price via their public api:

https://github.com/EverexIO/Ethplorer/wiki/Ethplorer-API

Am I missing anything, or do I have to rely on another API for this information?

Best Answer

(The Ethplorer API is specific to ERC-20 tokens, so won't give you what you want.)

Price is subjective, and different exchanges will trade at different rates depending on the markets that use them.

If you want an average price you'll need to either use several APIs - from those exchanges you care about - and take an average, or use a service that automatically averages across all exchanges. (Also, if you use the first method, you might want to think about weighting the average by the trade volume on the exchanges.)

I think the CoinMarketCap API does the averaging and weighting across the exchanges it knows about:

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

Output:

[
    {
        "id": "ethereum", 
        "name": "Ethereum", 
        "symbol": "ETH", 
        "rank": "2", 
        "price_usd": "472.07", 
        "price_btc": "0.0499671", 
        "24h_volume_usd": "1350430000.0", 
        "market_cap_usd": "45310507324.0", 
        "available_supply": "95982603.0", 
        "total_supply": "95982603.0", 
        "max_supply": null, 
        "percent_change_1h": "-3.34", 
        "percent_change_24h": "2.34", 
        "percent_change_7d": "31.86", 
        "last_updated": "1511776452"
    }
]

If you want a different quote currency, rather than USD or BTC, then you can do that, too.