BTCTradeAdapters { public static OrderBook adaptOrderBook(BTCTradeDepth btcTradeDepth, CurrencyPair currencyPair) { List<LimitOrder> asks = adaptLimitOrders(btcTradeDepth.getAsks(), currencyPair, OrderType.ASK); Collections.reverse(asks); List<LimitOrder> bids = adaptLimitOrders(btcTradeDepth.getBids(), currencyPair, OrderType.BID); return new OrderBook(null, asks, bids); } private  BTCTradeAdapters(); static Date adaptDatetime(String datetime); static CurrencyPair adaptCurrencyPair(String coin); static Ticker adaptTicker(BTCTradeTicker btcTradeTicker, CurrencyPair currencyPair); static OrderBook adaptOrderBook(BTCTradeDepth btcTradeDepth, CurrencyPair currencyPair); static Trades adaptTrades(BTCTradeTrade[] btcTradeTrades, CurrencyPair currencyPair); static boolean adaptResult(BTCTradeResult result); static Wallet adaptWallet(BTCTradeBalance balance); static String adaptDepositAddress(BTCTradeWallet wallet); static String adaptPlaceOrderResult(BTCTradePlaceOrderResult result); static OpenOrders adaptOpenOrders(BTCTradeOrder[] btcTradeOrders); static UserTrades adaptTrades(
      BTCTradeOrder[] btcTradeOrders, BTCTradeOrder[] btcTradeOrderDetails);  }
@Test public void testAdaptOrderBook() throws IOException { BTCTradeDepth btcTradeDepth = mapper.readValue(getClass().getResource("dto/marketdata/depth.json"), BTCTradeDepth.class); OrderBook orderBook = BTCTradeAdapters.adaptOrderBook(btcTradeDepth, CurrencyPair.BTC_CNY); assertEquals(50, orderBook.getAsks().size()); assertEquals(50, orderBook.getBids().size()); assertEquals(OrderType.ASK, orderBook.getAsks().get(0).getType()); assertEquals(CurrencyPair.BTC_CNY, orderBook.getAsks().get(0).getCurrencyPair()); assertEquals(new BigDecimal("3756.00000"), orderBook.getAsks().get(0).getLimitPrice()); assertEquals(new BigDecimal("0.685"), orderBook.getAsks().get(0).getOriginalAmount()); assertEquals(new BigDecimal("3758.00000"), orderBook.getAsks().get(1).getLimitPrice()); assertEquals(new BigDecimal("0.083"), orderBook.getAsks().get(1).getOriginalAmount()); assertEquals(new BigDecimal("4045.00000"), orderBook.getAsks().get(49).getLimitPrice()); assertEquals(new BigDecimal("1.402"), orderBook.getAsks().get(49).getOriginalAmount()); assertEquals(OrderType.BID, orderBook.getBids().get(0).getType()); assertEquals(CurrencyPair.BTC_CNY, orderBook.getBids().get(0).getCurrencyPair()); assertEquals(new BigDecimal("3730.00000"), orderBook.getBids().get(0).getLimitPrice()); assertEquals(new BigDecimal("1.066"), orderBook.getBids().get(0).getOriginalAmount()); assertEquals(new BigDecimal("3728.01000"), orderBook.getBids().get(1).getLimitPrice()); assertEquals(new BigDecimal("3.000"), orderBook.getBids().get(1).getOriginalAmount()); assertEquals(new BigDecimal("2951.00000"), orderBook.getBids().get(49).getLimitPrice()); assertEquals(new BigDecimal("4.000"), orderBook.getBids().get(49).getOriginalAmount()); }