KrakenAdapters { public static OrderBook adaptOrderBook(KrakenDepth krakenDepth, CurrencyPair currencyPair) { OrdersContainer asksOrdersContainer = adaptOrders(krakenDepth.getAsks(), currencyPair, OrderType.ASK); OrdersContainer bidsOrdersContainer = adaptOrders(krakenDepth.getBids(), currencyPair, OrderType.BID); return new OrderBook( new Date(Math.max(asksOrdersContainer.getTimestamp(), bidsOrdersContainer.getTimestamp())), asksOrdersContainer.getLimitOrders(), bidsOrdersContainer.getLimitOrders()); }  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 testAdaptOrderBook() throws JsonParseException, JsonMappingException, IOException { InputStream is = KrakenAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/kraken/dto/marketdata/example-depth-data.json"); ObjectMapper mapper = new ObjectMapper(); KrakenDepthResult krakenDepthResult = mapper.readValue(is, KrakenDepthResult.class); Map<String, KrakenDepth> krakenDepths = krakenDepthResult.getResult(); String krakenAssetPair = "XXBTZEUR"; KrakenDepth krakenDepth = krakenDepths.get(krakenAssetPair); OrderBook orderBook = KrakenAdapters.adaptOrderBook(krakenDepth, CurrencyPair.BTC_EUR); List<LimitOrder> asks = orderBook.getAsks(); assertThat(asks.size()).isEqualTo(3); LimitOrder order = asks.get(0); assertThat(order.getLimitPrice()).isEqualTo(new BigDecimal("530.75513")); assertThat(order.getOriginalAmount()).isEqualTo("0.248"); assertThat(order.getTimestamp()).isEqualTo(new Date(1391825343000L)); }