Merge pull request #69 from crisisking/master

Fixes the broken .bitcoin command
This commit is contained in:
Ryan Hitchman 2013-03-25 18:07:12 -07:00
commit bcc253fcd8
1 changed files with 10 additions and 4 deletions

View File

@ -4,7 +4,13 @@ from util import http, hook
@hook.command(autohelp=False) @hook.command(autohelp=False)
def bitcoin(inp, say=None): def bitcoin(inp, say=None):
".bitcoin -- gets current exchange rate for bitcoins from mtgox" ".bitcoin -- gets current exchange rate for bitcoins from mtgox"
data = http.get_json("https://mtgox.com/code/data/ticker.php") data = http.get_json("https://data.mtgox.com/api/2/BTCUSD/money/ticker")
ticker = data['ticker'] data = data['data']
say("Current: \x0307$%(buy).2f\x0f - High: \x0307$%(high).2f\x0f" ticker = {
" - Low: \x0307$%(low).2f\x0f - Volume: %(vol)s" % ticker) 'buy': data['buy']['display_short'],
'high': data['high']['display_short'],
'low': data['low']['display_short'],
'vol': data['vol']['display_short'],
}
say("Current: \x0307%(buy)s\x0f - High: \x0307%(high)s\x0f"
" - Low: \x0307%(low)s\x0f - Volume: %(vol)s" % ticker)