KrakenAdapters { public static List<FundingRecord> adaptFundingHistory( Map<String, KrakenLedger> krakenLedgerInfo) { final List<FundingRecord> fundingRecords = new ArrayList<>(); for (Entry<String, KrakenLedger> ledgerEntry : krakenLedgerInfo.entrySet()) { final KrakenLedger krakenLedger = ledgerEntry.getValue(); if (krakenLedger.getLedgerType() != null) { final Currency currency = adaptCurrency(krakenLedger.getAsset()); if (currency != null) { final Date timestamp = new Date((long) (krakenLedger.getUnixTime() * 1000L)); final FundingRecord.Type type = FundingRecord.Type.fromString(krakenLedger.getLedgerType().name()); if (type != null) { final String internalId = krakenLedger.getRefId(); FundingRecord fundingRecordEntry = new FundingRecord( null, timestamp, currency, krakenLedger.getTransactionAmount(), internalId, null, FundingRecord.Type.fromString(krakenLedger.getLedgerType().name()), FundingRecord.Status.COMPLETE, krakenLedger.getBalance(), krakenLedger.getFee(), null); fundingRecords.add(fundingRecordEntry); } } } } return fundingRecords; }  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 testAdaptFundingHistory() throws JsonParseException, JsonMappingException, IOException { InputStream is = KrakenAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/kraken/dto/account/example-ledgerinfo-data.json"); ObjectMapper mapper = new ObjectMapper(); KrakenLedgerResult krakenResult = mapper.readValue(is, KrakenLedgerResult.class); KrakenLedgerResult.KrakenLedgers ledgers = krakenResult.getResult(); Map<String, KrakenLedger> ledgerMap = ledgers.getLedgerMap(); List<FundingRecord> records = KrakenAdapters.adaptFundingHistory(ledgerMap); assertThat(records.size()).isEqualTo(3); FundingRecord fundingRecord = records.get(1); assertThat(fundingRecord).isInstanceOf(FundingRecord.class); assertThat(fundingRecord.getType()).isEqualTo(FundingRecord.Type.WITHDRAWAL); assertThat(fundingRecord.getStatus()).isEqualTo(FundingRecord.Status.COMPLETE); assertThat(fundingRecord.getAmount()).isEqualTo(new BigDecimal("15.9857300000")); assertThat(fundingRecord.getFee().doubleValue()) .isEqualTo(new BigDecimal("0.02").doubleValue()); assertThat(fundingRecord.getBalance().doubleValue()).isEqualTo(BigDecimal.ZERO.doubleValue()); }