KrakenAdapters { public static Wallet adaptWallet(Map<String, BigDecimal> krakenWallet) { List<Balance> balances = new ArrayList<>(krakenWallet.size()); for (Entry<String, BigDecimal> balancePair : krakenWallet.entrySet()) { Currency currency; try { currency = adaptCurrency(balancePair.getKey()); } catch (Exception e) { currency = Currency.getInstance(balancePair.getKey()); } Balance balance = new Balance(currency, balancePair.getValue()); balances.add(balance); } return Wallet.Builder.from(balances).build(); }  static OrderBook adaptOrderBook(KrakenDepth krakenDepth, CurrencyPair currencyPair); static OrdersContainer adaptOrders(
      List<KrakenPublicOrder> orders, CurrencyPair currencyPair, OrderType orderType); static List<Order> adaptOrders(Map<String, KrakenOrder> krakenOrdersMap); static Order adaptOrder(String orderId, KrakenOrder krakenOrder); static LimitOrder adaptOrder(
      KrakenPublicOrder order, OrderType orderType, CurrencyPair currencyPair); static Ticker adaptTicker(KrakenTicker krakenTicker, CurrencyPair currencyPair); static List<Ticker> adaptTickers(Map<String, KrakenTicker> krackenTickers); static Trades adaptTrades(
      List<KrakenPublicTrade> krakenTrades, CurrencyPair currencyPair, long last); static Trade adaptTrade(KrakenPublicTrade krakenPublicTrade, CurrencyPair currencyPair); static Wallet adaptWallet(Map<String, BigDecimal> krakenWallet); static Set<CurrencyPair> adaptCurrencyPairs(Collection<String> krakenCurrencyPairs); static Currency adaptCurrency(String krakenCurrencyCode); static CurrencyPair adaptCurrencyPair(String krakenCurrencyPair); static OpenOrders adaptOpenOrders(Map<String, KrakenOrder> krakenOrders); static UserTrades adaptTradesHistory(Map<String, KrakenTrade> krakenTrades); static KrakenUserTrade adaptTrade(KrakenTrade krakenTrade, String tradeId); static OrderType adaptOrderType(KrakenType krakenType); static String adaptKrakenDepositAddress(KrakenDepositAddress[] krakenDepositAddress); static String adaptOrderId(KrakenOrderResponse orderResponse); static ExchangeMetaData adaptToExchangeMetaData(
      ExchangeMetaData originalMetaData,
      Map<String, KrakenAssetPair> krakenPairs,
      Map<String, KrakenAsset> krakenAssets); static List<FundingRecord> adaptFundingHistory(
      Map<String, KrakenLedger> krakenLedgerInfo); static OrderStatus adaptOrderStatus(KrakenOrderStatus status);  }
@Test public void testAdaptBalance() throws IOException { InputStream is = KrakenAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/kraken/dto/account/example-balance-data.json"); ObjectMapper mapper = new ObjectMapper(); KrakenBalanceResult krakenBalance = mapper.readValue(is, KrakenBalanceResult.class); Wallet wallet = KrakenAdapters.adaptWallet(krakenBalance.getResult()); assertThat(wallet.getBalance(Currency.EUR).getTotal()).isEqualTo(new BigDecimal("1.0539")); assertThat(wallet.getBalance(Currency.BTC).getTotal()) .isEqualTo(new BigDecimal("0.4888583300")); assertThat(wallet.getBalance(Currency.getInstance("XDAO")).getTotal()) .isEqualTo(new BigDecimal("10.123")); }