def get_market_prices(self, market_id, currency=None): req = BFExchangeFactory.create("ns1:GetMarketPricesCompressedReq") req.marketId = market_id if currency: req.currencyCode = currency rsp = self._soapcall(BFExchangeService.getMarketPricesCompressed, req) if rsp.errorCode != GetMarketPricesErrorEnum.OK: error_code = rsp.errorCode if error_code == GetMarketPricesErrorEnum.API_ERROR: error_code = rsp.header.errorCode logger.error("{getMarketPricesCompressed} failed with error {%s}", error_code) raise ServiceError(error_code) prices = uncompress_market_prices(rsp.marketPrices) return prices
def test_uncompress_market_prices(): with open(path.join(DATA_DIR, "market_prices.dump")) as f: for line in f: uncompress_market_prices(line)