BitcoindeAdapters { public static OrderBook adaptOrderBook( BitcoindeOrderbookWrapper asksWrapper, BitcoindeOrderbookWrapper bidsWrapper, CurrencyPair currencyPair) { final List<LimitOrder> asks = createOrders(currencyPair, OrderType.ASK, asksWrapper.getBitcoindeOrders()); final List<LimitOrder> bids = createOrders(currencyPair, OrderType.BID, bidsWrapper.getBitcoindeOrders()); Collections.sort(asks); Collections.sort(bids); return new OrderBook(null, asks, bids); } 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 testOrderBookAdapter() throws IOException { final InputStream is = BitcoindeAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/bitcoinde/v4/dto/orderbook.json"); final ObjectMapper mapper = new ObjectMapper(); final BitcoindeOrderbookWrapper bitcoindeOrderBook = mapper.readValue(is, BitcoindeOrderbookWrapper.class); final OrderBook orderBook = BitcoindeAdapters.adaptOrderBook( bitcoindeOrderBook, bitcoindeOrderBook, CurrencyPair.BCH_EUR); final LimitOrder firstBid = orderBook.getBids().get(0); final BitcoindeOrderFlagsTradingPartnerInformation tpi = new BitcoindeOrderFlagsTradingPartnerInformation("bla", true, BitcoindeTrustLevel.GOLD); final BitcoindeOrderFlagsOrderRequirements or = new BitcoindeOrderFlagsOrderRequirements(BitcoindeTrustLevel.GOLD); final BitcoindeOrderFlagsOrderQuantities oqty = new BitcoindeOrderFlagsOrderQuantities( new BigDecimal("0.1"), new BigDecimal("0.5"), new BigDecimal("23.06"), new BigDecimal("115.28")); assertThat(firstBid.getLimitPrice()).isEqualByComparingTo("230.55"); assertThat(firstBid.getType()).isEqualTo(OrderType.BID); assertThat(firstBid.getOriginalAmount()).isEqualByComparingTo("0.5"); assertThat(firstBid.getInstrument()).isEqualTo(CurrencyPair.BCH_EUR); assertThat(firstBid.hasFlag(tpi)).isEqualTo(true); assertThat(firstBid.hasFlag(or)).isEqualTo(true); assertThat(firstBid.hasFlag(oqty)).isEqualTo(true); testTradingPartnerInformation(firstBid, tpi); testOrderRequirements(firstBid, or); testOrderQuantities(firstBid, oqty); }