bitbitbit
This commit is contained in:
parent
3825c94c9d
commit
d3fbf1bc80
1 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,11 @@ from util import http, hook
|
||||||
def bitcoin(inp):
|
def bitcoin(inp):
|
||||||
"bitcoin <exchange> -- Gets current exchange rate for bitcoins from several exchanges, default is MtGox. Supports MtGox, Bitpay, and BitStamp."
|
"bitcoin <exchange> -- Gets current exchange rate for bitcoins from several exchanges, default is MtGox. Supports MtGox, Bitpay, and BitStamp."
|
||||||
exchanges = {
|
exchanges = {
|
||||||
|
"blockchain": {
|
||||||
|
"api_url": "https://blockchain.info/ticker",
|
||||||
|
"func": lambda data: u"Blockchain // Buy: \x0307${:,.2f}\x0f - Sell: \x0307${:,.2f}\x0f".format(data["USD"]["buy"], \
|
||||||
|
data["USD"]["sell"])
|
||||||
|
},
|
||||||
"mtgox": {
|
"mtgox": {
|
||||||
"api_url": "https://mtgox.com/api/1/BTCUSD/ticker",
|
"api_url": "https://mtgox.com/api/1/BTCUSD/ticker",
|
||||||
"func": lambda data: u"MtGox // Current: \x0307{}\x0f - High: \x0307{}\x0f - Low: \x0307{}\x0f - Best Ask: \x0307{}\x0f - Volume: {}".format(data['return']['last']['display'], \
|
"func": lambda data: u"MtGox // Current: \x0307{}\x0f - High: \x0307{}\x0f - Low: \x0307{}\x0f - Best Ask: \x0307{}\x0f - Volume: {}".format(data['return']['last']['display'], \
|
||||||
|
@ -31,7 +36,7 @@ def bitcoin(inp):
|
||||||
else:
|
else:
|
||||||
return "Invalid Exchange"
|
return "Invalid Exchange"
|
||||||
else:
|
else:
|
||||||
exchange = exchanges["mtgox"]
|
exchange = exchanges["blockchain"]
|
||||||
|
|
||||||
data = http.get_json(exchange["api_url"])
|
data = http.get_json(exchange["api_url"])
|
||||||
func = exchange["func"]
|
func = exchange["func"]
|
||||||
|
|
Reference in a new issue