From d3b01bcf975e87d9f5161c65a6fe8662982d45ad Mon Sep 17 00:00:00 2001 From: Flummi Date: Thu, 21 Sep 2017 04:08:50 +0000 Subject: [PATCH] added Monreo --- bot/coins.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/bot/coins.py b/bot/coins.py index de3263f..023199a 100644 --- a/bot/coins.py +++ b/bot/coins.py @@ -8,12 +8,13 @@ from . import Plugin class Coins(Plugin): - API_URL = 'https://api.cryptowat.ch/markets/coinbase/{crypto}{currency}/summary' + API_URL = 'https://api.cryptowat.ch/markets/{market}/{crypto}{currency}/summary' CURRENCIES = { 'usd': '$', 'eur': '€', 'eth': 'Ξ', 'btc': '฿', + 'xmr': 'xmr', } @command @@ -22,23 +23,31 @@ class Coins(Plugin): %%btc [] """ - return self.cryptowat_summary('btc', args) - + return self.cryptowat_summary('btc', 'coinbase', args) + @command def eth(self, mask: IrcString, target: IrcString, args: Dict): """Gets the Ethereum values from cryptowatch. %%eth [] """ - return self.cryptowat_summary('eth', args) + return self.cryptowat_summary('eth', 'coinbase', args) + + @command + def xmr(self, mask: IrcString, target: IrcString, args: Dict): + """Gets the Monreo values from cryptowatch. - def cryptowat_summary(self, crypto: str, args: Dict): + %%xmr [] + """ + return self.cryptowat_summary('xmr', 'bitfinex', args) + + def cryptowat_summary(self, crypto: str, market: market, args: Dict): currency = args.get('', 'usd') if currency not in self.CURRENCIES or crypto == currency: return '\x02[{}]\x02 Can\'t convert or invalid currency: {}'.format(crypto.upper(), currency) - data = requests.get(self.API_URL.format(crypto=crypto, currency=currency)) + data = requests.get(self.API_URL.format(crypto=crypto, market=market, currency=currency)) if not data: return '\x02[{}]\x02 No data received'.format(crypto)