From 0e73e8b498cb2441c84d6288a7a88ca9ca82f4b0 Mon Sep 17 00:00:00 2001 From: Marcdnd Date: Fri, 20 Jan 2017 16:50:30 -0200 Subject: [PATCH] Added BRL exchanges: Bitvalor, Foxbit, NegocieCoins --- lib/exchange_rate.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/exchange_rate.py b/lib/exchange_rate.py index 4b2cdd5e..8bbedadf 100644 --- a/lib/exchange_rate.py +++ b/lib/exchange_rate.py @@ -255,9 +255,8 @@ class Winkdex(ExchangeBase): class MercadoBitcoin(ExchangeBase): def get_rates(self,ccy): - json = self.get_json('mercadobitcoin.net', - "/api/ticker/ticker_bitcoin") - return {'BRL': Decimal(json['ticker']['last'])} + json = requests.get('http://api.bitvalor.com/v1/ticker.json').json() + return {'BRL': Decimal(json['ticker_1h']['exchanges']['MBT']['last'])} def history_ccys(self): return ['BRL'] @@ -271,6 +270,31 @@ class Bitcointoyou(ExchangeBase): def history_ccys(self): return ['BRL'] +class Bitvalor(ExchangeBase): + def get_rates(self,ccy): + json = requests.get('http://api.bitvalor.com/v1/ticker.json').json() + return {'BRL': Decimal(json['ticker_1h']['total']['last'])} + + def history_ccys(self): + return ['BRL'] + + +class Foxbit(ExchangeBase): + def get_rates(self,ccy): + json = requests.get('http://api.bitvalor.com/v1/ticker.json').json() + return {'BRL': Decimal(json['ticker_1h']['exchanges']['FOX']['last'])} + + def history_ccys(self): + return ['BRL'] + +class NegocieCoins(ExchangeBase): + def get_rates(self,ccy): + json = requests.get('http://api.bitvalor.com/v1/ticker.json').json() + return {'BRL': Decimal(json['ticker_1h']['exchanges']['NEG']['last'])} + + def history_ccys(self): + return ['BRL'] + def dictinvert(d): inv = {}