diff --git a/bot/coins.py b/bot/coins.py index 749d529..01c8bfc 100644 --- a/bot/coins.py +++ b/bot/coins.py @@ -55,12 +55,12 @@ class Coins(Plugin): if currency not in self.CURRENCIES or crypto == currency: return '\x02[{}]\x02 Can\'t convert or invalid currency: {}'.format(crypto.upper(), currency) - currency = self.CURRENCIES[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) + to_currency = self.CURRENCIES[currency] + result = data.json()['result'] return '\x02[{crypto}]\x02 ' \ 'Current: \x02\x0307{last}\x0F - ' \ @@ -69,8 +69,8 @@ class Coins(Plugin): 'Change: \x02\x0307{change:,.2f}%\x0F - ' \ 'Volume: \x02\x0307{volume}\x0F' \ .format(crypto=crypto.upper(), - last=currency(result['price']['last']), - high=currency(result['price']['high']), - low=currency(result['price']['low']), + last=to_currency(result['price']['last']), + high=to_currency(result['price']['high']), + low=to_currency(result['price']['low']), change=result['price']['change']['percentage'] * 100, volume=result['volume'])