DEV Community

Cover image for Ethereum price
codesharedot
codesharedot

Posted on

Ethereum price

You may have heard about bitcoin, but did you know about Ethereum? No, Ethereum is not just another blockchain based coin.

Ethereum is an open-source, public, blockchain-based distributed computing platform and operating system featuring smart contract functionality.

  • Ether is a token whose blockchain is generated by the Ethereum platform.
  • Ether can be transferred between accounts and used to compensate participant mining nodes for computations performed.
  • Ethereum provides a decentralized virtual machine, the Ethereum Virtual Machine (EVM), which can execute scripts using an international network of public nodes

Price

Much of our lives revolve around assets, currency and money. We are so used to measure everything in price. So what is the price of ether?

Because it's not just another bitcoin copy, this could be something you invest in (this is not financial advice). But how do you know the current ether price?

You can fetch it with Python

#!/usr/bin/python3
import requests
import json
from forex_python.converter import CurrencyRates
import os

c = CurrencyRates() 
rate = c.get_rate('USD', 'EUR') 
print(rate)

ethereum_api_url = 'https://api.coinmarketcap.com/v1/ticker/ethereum/'
response = requests.get(ethereum_api_url)
response_json = response.json()
print(response_json)

for coin in response.json():
    price = coin.get("price_usd", "U$S Price not provided")
    coin_price = float(("{0:.2f}").format(float(price)))
    print("$ " + str(coin_price))
    coin_price_eur = float(("{0:.2f}").format(float(price)*rate))   
    print("€ " + str(coin_price_eur))

reference: https://gitlab.com/codelivespeed/ethereum-price

That will output the current price in us dollars and euros. Exchange rate is calculated with the module CurrencyRates.

Read more:

Top comments (0)