def _handle_response(self, response):
     try:
         json_response = json.loads(response)
     except ValueError:
         raise InvalidExchangeRateResponse(
             self.name, "invalid rate response : %s" % response)
     if 'data' not in json_response:
         raise InvalidExchangeRateResponse(self.name, 'result not found')
     return 1.0 / json_response['data']['btc_usd']
 def _handle_response(self, response):
     try:
         json_response = json.loads(response)
     except ValueError:
         raise InvalidExchangeRateResponse(self.name,
                                           "invalid rate response")
     if 'ticker' not in json_response or len(json_response['ticker']) == 0 or \
             'success' not in json_response or json_response['success'] is not True:
         raise InvalidExchangeRateResponse(self.name, 'result not found')
     return float(json_response['ticker']['price'])
 def _handle_response(self, response):
     json_response = json.loads(response)
     if 'result' not in json_response:
         raise InvalidExchangeRateResponse(self.name, 'result not found')
     trades = json_response['result']
     if len(trades) == 0:
         raise InvalidExchangeRateResponse(self.market, 'trades not found')
     totals = sum([i['Total'] for i in trades])
     qtys = sum([i['Quantity'] for i in trades])
     if totals <= 0 or qtys <= 0:
         raise InvalidExchangeRateResponse(self.market,
                                           'quantities were not positive')
     vwap = totals / qtys
     return float(1.0 / vwap)
 def _handle_response(self, response):
     json_response = json.loads(response)
     if 'data' not in json_response:
         raise InvalidExchangeRateResponse(self.name, 'result not found')
     return 1.0 / json_response['data']['lbc_btc']