16 lines
735 B
Python
Executable file
16 lines
735 B
Python
Executable file
from util import http, hook
|
|
|
|
|
|
@hook.command(autohelp=False)
|
|
def bitcoin(inp, say=None):
|
|
"""bitcoin -- gets current exchange rate for bitcoins from mtgox"""
|
|
data = http.get_json("https://data.mtgox.com/api/2/BTCUSD/money/ticker")
|
|
data = data['data']
|
|
ticker = {
|
|
'buy': data['buy']['display_short'].encode('ascii','ignore'),
|
|
'high': data['high']['display_short'].encode('ascii','ignore'),
|
|
'low': data['low']['display_short'].encode('ascii','ignore'),
|
|
'vol': data['vol']['display_short'].encode('ascii','ignore'),
|
|
}
|
|
say("Current: \x0307{!s}\x0f - High: \x0307{!s}\x0f"
|
|
" - Low: \x0307{!s}\x0f - Volume: {!s}".format(ticker['buy'],ticker['high'],ticker['low'],ticker['vol']))
|