Coingecko

Coingecko is a site to lookup prices of crypto currencies and stats. (https://www.coingecko.com)

Here is some Python code to convert an ETH amount to the current USD value using their API.

def eth2usd(amount): api_url="https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd" try: req = requests.get(api_url) req.raise_for_status except Exception as err: print('failed to talk to Coingecko - {0} - {1}'.format(err.message, err.args)) sys.exit(2) try: resp = req.json except Exception as err: print('failed to parse JSON - {0} - {1}'.format(err.message, err.args)) sys.exit(2) usd_value = float((resp['ethereum']['usd'] * amount)) return usd_value
 * 1) convert an ETH amount to USD value, using Coingecko

total_usd=round(eth2usd(total_eth_eth)) print('Total: ' + str(total_usd) + ' $ (@' + str(eth2usd(1)) + '$/Ξ)')


 * https://www.coingecko.com/api