BitcoindeAdapters { public static OpenOrders adaptOpenOrders(BitcoindeMyOrdersWrapper bitcoindeOpenOrdersWrapper) { final List<LimitOrder> orders = new ArrayList<>(); for (BitcoindeMyOrder bitcoindeMyOrder : bitcoindeOpenOrdersWrapper.getOrders()) { final LimitOrder limitOrder = new LimitOrder.Builder( adaptOrderType(bitcoindeMyOrder.getType()), bitcoindeMyOrder.getTradingPair()) .id(bitcoindeMyOrder.getOrderId()) .timestamp(bitcoindeMyOrder.getCreatedAt()) .originalAmount(bitcoindeMyOrder.getMaxAmount()) .limitPrice(bitcoindeMyOrder.getPrice()) .orderStatus(adaptOrderStatus(bitcoindeMyOrder.getState())) .flag( new BitcoindeOrderFlagsOrderQuantities( bitcoindeMyOrder.getMinAmount(), bitcoindeMyOrder.getMaxAmount(), bitcoindeMyOrder.getMinVolume(), bitcoindeMyOrder.getMaxVolume())) .flag(adaptOrderRequirements(bitcoindeMyOrder.getOrderRequirements())) .build(); orders.add(limitOrder); } return new OpenOrders(orders); } 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 testOpenOrdersAdapter() throws IOException { final InputStream is = BitcoindeAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/bitcoinde/v4/dto/my_orders.json"); final ObjectMapper mapper = new ObjectMapper(); BitcoindeMyOrdersWrapper bitcoindeOpenOrdersWrapper = mapper.readValue(is, BitcoindeMyOrdersWrapper.class); final OpenOrders openOrders = BitcoindeAdapters.adaptOpenOrders(bitcoindeOpenOrdersWrapper); assertThat(openOrders.getOpenOrders()).isNotNull(); assertThat(openOrders.getOpenOrders().size()).isEqualTo(1); LimitOrder order = openOrders.getOpenOrders().get(0); assertThat(order.getId()).isEqualTo("VNSP86"); assertThat(order.getType()).isEqualTo(OrderType.BID); assertThat(order.getInstrument()).isEqualTo(CurrencyPair.BTC_EUR); assertThat(order.getTimestamp()).isEqualTo("2018-01-25T17:35:19+01:00"); assertThat(order.getOriginalAmount()).isEqualByComparingTo("0.01"); assertThat(order.getLimitPrice()).isEqualByComparingTo("6000"); assertThat(order.getStatus()).isEqualTo(OrderStatus.NEW); assertThat(order.getOrderFlags()) .containsOnly( new BitcoindeOrderFlagsOrderQuantities( new BigDecimal("0.01"), new BigDecimal("0.01"), new BigDecimal("60"), new BigDecimal("60")), new BitcoindeOrderFlagsOrderRequirements( BitcoindeTrustLevel.SILVER, false, new String[] { "AT", "BE", "BG", "CH", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GB", "GR", "HR", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MQ", "MT", "NL", "NO", "PL", "PT", "RO", "SE", "SI", "SK" }, BitcoindePaymentOption.EXPRESS_SEPA)); assertThat(order.getAveragePrice()).isNull(); assertThat(order.getCumulativeAmount()).isNull(); assertThat(order.getFee()).isNull(); }