ZaifAdapters { public static OrderBook adaptOrderBook(ZaifFullBook book, CurrencyPair currencyPair) { List<LimitOrder> asks = toLimitOrderList(book.getAsks(), Order.OrderType.ASK, currencyPair); List<LimitOrder> bids = toLimitOrderList(book.getBids(), Order.OrderType.BID, currencyPair); return new OrderBook(null, asks, bids); } ZaifAdapters(); static OrderBook adaptOrderBook(ZaifFullBook book, CurrencyPair currencyPair); static ExchangeMetaData adaptMetadata(List<ZaifMarket> markets);  }
@Test public void testFullBookAdapter() throws IOException { InputStream is = ZaifAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/zaif/marketdata/example-fullbook-data.json"); ObjectMapper mapper = new ObjectMapper(); ZaifFullBook zaifFullBook = mapper.readValue(is, ZaifFullBook.class); OrderBook orderBook = ZaifAdapters.adaptOrderBook(zaifFullBook, CurrencyPair.BTC_JPY); assertThat(orderBook.getBids().get(0).getCurrencyPair()).isEqualTo(CurrencyPair.BTC_JPY); assertThat(orderBook.getBids().get(0).getLimitPrice()).isEqualTo("934920"); assertThat(orderBook.getBids().get(0).getOriginalAmount()).isEqualTo("0.03"); assertThat(orderBook.getAsks().get(0).getLimitPrice()).isEqualTo("935355"); assertThat(orderBook.getAsks().get(0).getOriginalAmount()).isEqualTo("0.02"); }