Skip to content

Instantly share code, notes, and snippets.

@dansku
Created September 4, 2013 19:55
Show Gist options
  • Save dansku/6442033 to your computer and use it in GitHub Desktop.
Save dansku/6442033 to your computer and use it in GitHub Desktop.
Get Bitcoin & Litecoin Price in Python
import urllib2, json
BTC = json.loads(urllib2.urlopen('https://mtgox.com/api/1/BTCUSD/ticker').read())
btcAtual = BTC['return']['last']['value']
btcHigh = BTC['return']['high']['value']
btcLow = BTC['return']['low']['value']
LTC = json.loads(urllib2.urlopen('https://btc-e.com/api/2/ltc_usd/ticker').read())
ltcAtual = str(LTC['ticker']['last'])
ltcHigh = str(LTC['ticker']['high'])
ltcLow = str(LTC['ticker']['low'])
print ''
print '---[ Preco Bitcoin ]---------------------------------'
print 'BITCOIN -> Atual: ' + btcAtual + ' - High: ' + btcHigh + ' - Low: ' + btcLow
print 'LITECOIN -> Atual: ' + ltcAtual + ' - High: ' + ltcHigh + ' - Low: ' + ltcLow
print '-----------------------------------------------------'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment