BitcoindeAdapters { public static Trades adaptTrades( BitcoindeTradesWrapper bitcoindeTradesWrapper, CurrencyPair currencyPair) { final List<Trade> trades = new ArrayList<>(); long lastTradeId = 0; for (BitcoindeTrade bitcoindeTrade : bitcoindeTradesWrapper.getTrades()) { final long tid = bitcoindeTrade.getTid(); if (tid > lastTradeId) { lastTradeId = tid; } trades.add( new Trade.Builder() .originalAmount(bitcoindeTrade.getAmount()) .currencyPair(currencyPair) .price(bitcoindeTrade.getPrice()) .timestamp(bitcoindeTrade.getDate()) .id(String.valueOf(tid)) .build()); } return new Trades(trades, lastTradeId, TradeSortType.SortByID); } private  BitcoindeAdapters(); static OrderBook adaptCompactOrderBook(
      BitcoindeCompactOrderbookWrapper bitcoindeOrderbookWrapper, CurrencyPair currencyPair); static OrderBook adaptOrderBook(
      BitcoindeOrderbookWrapper asksWrapper,
      BitcoindeOrderbookWrapper bidsWrapper,
      CurrencyPair currencyPair); static List<LimitOrder> createCompactOrders(
      CurrencyPair currencyPair, OrderType orderType, BitcoindeCompactOrder[] orders); static LimitOrder createOrder(
      CurrencyPair currencyPair,
      BitcoindeOrder bitcoindeOrder,
      OrderType orderType,
      String orderId,
      Date timeStamp); static Trades adaptTrades(
      BitcoindeTradesWrapper bitcoindeTradesWrapper, CurrencyPair currencyPair); static AccountInfo adaptAccountInfo(BitcoindeAccountWrapper bitcoindeAccount); static List<FundingRecord> adaptFundingHistory(
      final Currency currency,
      final List<BitcoindeAccountLedger> accountLedgers,
      final boolean leaveFeesSeperate); static FundingRecord.Type adaptFundingRecordType(BitcoindeAccountLedgerType type); static UserTrades adaptTradeHistory(BitcoindeMyTradesWrapper bitcoindeMyTradesWrapper); static UserTrades adaptTradeHistory(
      BitcoindeMyTradesWrapper bitcoindeMyTradesWrapper, TradeSortType sortType); static OpenOrders adaptOpenOrders(BitcoindeMyOrdersWrapper bitcoindeOpenOrdersWrapper); static OrderType adaptOrderType(final BitcoindeType type); static OrderStatus adaptOrderStatus(final BitcoindeOrderState state);  }
@Test public void testTradesAdapter() throws IOException { final InputStream is = BitcoindeAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/bitcoinde/v4/dto/trades.json"); final ObjectMapper mapper = new ObjectMapper(); final BitcoindeTradesWrapper bitcoindeTradesWrapper = mapper.readValue(is, BitcoindeTradesWrapper.class); final Trades trades = BitcoindeAdapters.adaptTrades(bitcoindeTradesWrapper, CurrencyPair.BTC_EUR); final Trade firstTrade = trades.getTrades().get(0); assertThat(trades.getTrades().size()).isEqualTo(92); assertThat(trades.getlastID()).isEqualTo(2844384); assertThat(firstTrade.getId()).isEqualTo("2844111"); assertThat(firstTrade.getPrice()).isEqualTo(new BigDecimal("2395")); assertThat(firstTrade.getOriginalAmount()).isEqualTo(new BigDecimal("0.08064516")); assertThat(firstTrade.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_EUR); assertThat(firstTrade.getTimestamp()).isEqualTo(new Date(1500717160L * 1000)); }