Get Ethereum Value from Command Line

By  on  
Ethereum

Last year I got big into Bitcoin; today I own a few dozen bitcoin and am loving my return.  Recently I've been hearing big things about Ethereum, another cryptocurrency.  Ethereum is in its infancy and has hit some troublesome times recently due to a hack but hey -- at its roughly $10 value now, if it ever hits bitcoin-type heights, you could be in for a great return on investment.  A while back I wrote a few scripts to get bitcoin value so I thought I'd repeat that post for getting Ether value!

Get Ether Value from Command Line

I use a snippet of python to to grab the value of ether from command line:

curl -s https://coinmarketcap-nexuist.rhcloud.com/api/eth | python -c "import json, sys; print(json.load(sys.stdin)['price']['usd']")

Since you buy ether with bitcoin, getting its bitcoin value may be more of value:

curl -s https://coinmarketcap-nexuist.rhcloud.com/api/eth | python -c "import json, sys; print(json.load(sys.stdin)['price']['btc'])"

Get Either Value with Node.js

You can use a library like Request for making the API request but to avoid dependency you can use the base Node.js API:

var http = require('http');

http.get({
        host: 'coinmarketcap-nexuist.rhcloud.com',
        path: '/api/eth'
        },
        function(response) {
                // Continuously update stream with data
                var body = '';
                response.on('data', function(d) { body += d; });
                response.on('end', function() {

                        // Data reception is done, do whatever with it!
                        var parsed = JSON.parse(body);
                        console.log(parsed.price.usd);
                });
        }
);

Cryptocurrency lovers will hate on me for talking about bitcoin and ether in terms of USD dollar price but I still see these cryptocurrencies as a short term investment right now.  Many online stores don't accept bitcoin yet so I don't see a great application right now.  Whatever your reason for wanting to know the price of ether, these scripts will be what you need!

Recent Features

  • By
    Create a CSS Cube

    CSS cubes really showcase what CSS has become over the years, evolving from simple color and dimension directives to a language capable of creating deep, creative visuals.  Add animation and you've got something really neat.  Unfortunately each CSS cube tutorial I've read is a bit...

  • By
    LightFace:  Facebook Lightbox for MooTools

    One of the web components I've always loved has been Facebook's modal dialog.  This "lightbox" isn't like others:  no dark overlay, no obnoxious animating to size, and it doesn't try to do "too much."  With Facebook's dialog in mind, I've created LightFace:  a Facebook lightbox...

Incredible Demos

  • By
    Create a Download Package Using MooTools Moousture

    Zohaib Sibt-e-Hassan recently released a great mouse gestures library for MooTools called Moousture. Moousture allows you to trigger functionality by moving your mouse in specified custom patterns. Too illustrate Moousture's value, I've created an image download builder using Mooustures and PHP. The XHTML We provide...

  • By
    New MooTools Plugin:  ElementFilter

    My new MooTools plugin, ElementFilter, provides a great way for you to allow users to search through the text of any mix of elements. Simply provide a text input box and ElementFilter does the rest of the work. The XHTML I've used a list for this example...

Discussion

  1. dlt074

    Great post.
    There is a syntax error in your first command. That ” needs to be moved to the end of the command.

    Have you checked out jq for parsing JSON on the command line? Works great.

    curl -s https://coinmarketcap-nexuist.rhcloud.com/api/all | jq .eth.price.usd

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!