From d3b01bcf975e87d9f5161c65a6fe8662982d45ad Mon Sep 17 00:00:00 2001 From: Flummi Date: Thu, 21 Sep 2017 04:08:50 +0000 Subject: [PATCH 1/3] 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) From bbd2c65338cf0198f1a85fe02559972bf80ea3e9 Mon Sep 17 00:00:00 2001 From: Flummi Date: Thu, 21 Sep 2017 09:39:01 +0000 Subject: [PATCH 2/3] oops :o --- bot/coins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/coins.py b/bot/coins.py index 023199a..01cbb73 100644 --- a/bot/coins.py +++ b/bot/coins.py @@ -41,7 +41,7 @@ class Coins(Plugin): """ return self.cryptowat_summary('xmr', 'bitfinex', args) - def cryptowat_summary(self, crypto: str, market: market, args: Dict): + def cryptowat_summary(self, crypto: str, market: str, args: Dict): currency = args.get('', 'usd') if currency not in self.CURRENCIES or crypto == currency: From 7c0804778010c110128f9493eb0b725b994982fe Mon Sep 17 00:00:00 2001 From: Flummi Date: Thu, 21 Sep 2017 10:56:21 +0000 Subject: [PATCH 3/3] Update coins.py --- bot/coins.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/coins.py b/bot/coins.py index 01cbb73..33e21c1 100644 --- a/bot/coins.py +++ b/bot/coins.py @@ -14,7 +14,7 @@ class Coins(Plugin): 'eur': '€', 'eth': 'Ξ', 'btc': '฿', - 'xmr': 'xmr', + 'monreo': 'xmr', } @command @@ -39,7 +39,7 @@ class Coins(Plugin): %%xmr [] """ - return self.cryptowat_summary('xmr', 'bitfinex', args) + return self.cryptowat_summary('monreo', 'bitfinex', args) def cryptowat_summary(self, crypto: str, market: str, args: Dict): currency = args.get('', 'usd')