KrakenAdapters { public static OpenOrders adaptOpenOrders(Map<String, KrakenOrder> krakenOrders) { List<LimitOrder> limitOrders = new ArrayList<>(); for (Entry<String, KrakenOrder> krakenOrderEntry : krakenOrders.entrySet()) { KrakenOrder krakenOrder = krakenOrderEntry.getValue(); KrakenOrderDescription orderDescription = krakenOrder.getOrderDescription(); if (!"limit".equals(orderDescription.getOrderType().toString())) { continue; } limitOrders.add((LimitOrder) adaptOrder(krakenOrderEntry.getKey(), krakenOrder)); } return new OpenOrders(limitOrders); }  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 testAdaptOpenOrders() throws IOException { InputStream is = KrakenAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/kraken/dto/trading/example-openorders-data.json"); ObjectMapper mapper = new ObjectMapper(); KrakenOpenOrdersResult krakenResult = mapper.readValue(is, KrakenOpenOrdersResult.class); OpenOrders orders = KrakenAdapters.adaptOpenOrders(krakenResult.getResult().getOrders()); assertThat(orders.getOpenOrders()).hasSize(6); assertThat(orders.getOpenOrders().get(0).getId()).isEqualTo("O767CW-TXHCL-FWZ5R2"); assertThat(orders.getOpenOrders().get(0).getLimitPrice()).isEqualTo("0.00001000"); assertThat(orders.getOpenOrders().get(0).getOriginalAmount()).isEqualTo("1000.00000000"); assertThat(orders.getOpenOrders().get(0).getCurrencyPair().base).isEqualTo(Currency.XRP); assertThat(orders.getOpenOrders().get(0).getCurrencyPair().counter).isEqualTo(Currency.BTC); assertThat(orders.getOpenOrders().get(0).getType()).isEqualTo(OrderType.BID); }
@Test public void testAdaptOpenOrdersInTransactionCurrency() throws IOException { InputStream is = KrakenAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/kraken/dto/trading/example-openorders-in-transaction-currency-data.json"); ObjectMapper mapper = new ObjectMapper(); KrakenOpenOrdersResult krakenResult = mapper.readValue(is, KrakenOpenOrdersResult.class); OpenOrders orders = KrakenAdapters.adaptOpenOrders(krakenResult.getResult().getOrders()); assertThat(orders.getOpenOrders()).hasSize(1); assertThat(orders.getOpenOrders().get(0).getId()).isEqualTo("OR6QMM-BCKM4-Q6YHIN"); assertThat(orders.getOpenOrders().get(0).getLimitPrice()).isEqualTo("500.00000"); assertThat(orders.getOpenOrders().get(0).getOriginalAmount()).isEqualTo("1.00000000"); assertThat(orders.getOpenOrders().get(0).getCurrencyPair().base).isEqualTo(Currency.BTC); assertThat(orders.getOpenOrders().get(0).getCurrencyPair().counter).isEqualTo(Currency.EUR); assertThat(orders.getOpenOrders().get(0).getType()).isEqualTo(OrderType.BID); }