Skip to content

Instantly share code, notes, and snippets.

@johl
Created November 24, 2011 20:32
Show Gist options
  • Save johl/1392212 to your computer and use it in GitHub Desktop.
Save johl/1392212 to your computer and use it in GitHub Desktop.
BITCOIN_EXECUTABLE = '/Applications/Bitcoin.app/Contents/MacOS/bitcoin' and require 'bitcoin'
require 'json'
require 'rest_client'
currency = 'EUR'
balance = Bitcoin::Client.getinfo()['balance']
balanceCUR = JSON.parse(RestClient.get "https://mtgox.com/api/0/data/ticker.php?Currency=#{currency}".to_str)['ticker']['avg'] * balance
puts "You have #{balance} BTC, which is currently #{balanceCUR} #{currency}."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment