Created
September 4, 2013 19:55
-
-
Save dansku/6442033 to your computer and use it in GitHub Desktop.
Get Bitcoin & Litecoin Price in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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