BithumbAdapters { public static LimitOrder adaptOrder(BithumbOrder order) { final CurrencyPair currencyPair = adaptCurrencyPair(order.getOrderCurrency(), order.getPaymentCurrency()); final Order.OrderType orderType = adaptOrderType(order.getType()); Order.OrderStatus status = Order.OrderStatus.UNKNOWN; if (order.getUnitsRemaining().compareTo(order.getUnits()) == 0) { status = Order.OrderStatus.NEW; } else if (order.getUnitsRemaining().compareTo(BigDecimal.ZERO) == 0) { status = Order.OrderStatus.FILLED; } else { status = Order.OrderStatus.PARTIALLY_FILLED; } return new LimitOrder.Builder(orderType, currencyPair) .id(String.valueOf(order.getOrderId())) .limitPrice(order.getPrice()) .originalAmount(order.getUnits()) .remainingAmount(order.getUnitsRemaining()) .orderStatus(status) .timestamp(new Date(order.getOrderDate() / 1000L)) .build(); } private  BithumbAdapters(); static OrderBook adaptOrderBook(BithumbOrderbook orderbook); static AccountInfo adaptAccountInfo(BithumbAccount account, BithumbBalance balance); static Ticker adaptTicker(BithumbTicker bithumbTicker, CurrencyPair currencyPair); static List<Ticker> adaptTickers(BithumbTickersReturn bithumbTickers); static Trades adaptTransactions(
      List<BithumbTransactionHistory> bithumbTrades, CurrencyPair currencyPair); static Trade adaptTransactionHistory(
      BithumbTransactionHistory trade, CurrencyPair currencyPair); static OpenOrders adaptOrders(List<BithumbOrder> bithumbOrders); static LimitOrder adaptOrder(BithumbOrder order); static UserTrades adaptUserTrades(
      List<BithumbUserTransaction> transactions, CurrencyPair currencyPair); static Order adaptOrderDetail(BithumbOrderDetail order, String id); static CurrencyPair adaptCurrencyPair(String orderCurrency, String paymentCurrency); static final String SEARCH_BUY; static final String SEARCH_SELL; }
@Test public void testAdaptOpenOrder() throws IOException { InputStream is = BithumbAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/bithumb/dto/account/example-order.json"); final BithumbResponse<List<BithumbOrder>> bithumbOrderResponse = mapper.readValue(is, new TypeReference<BithumbResponse<List<BithumbOrder>>>() {}); final LimitOrder limitOrder = BithumbAdapters.adaptOrder(bithumbOrderResponse.getData().stream().findFirst().get()); assertThat(limitOrder.getLimitPrice()).isEqualTo(BigDecimal.valueOf(501000)); assertThat(limitOrder.getType()).isEqualTo(Order.OrderType.BID); assertThat(limitOrder.getOriginalAmount()).isEqualTo(BigDecimal.valueOf(5.0)); assertThat(limitOrder.getCumulativeAmount()).isEqualTo(BigDecimal.valueOf(0.0)); assertThat(limitOrder.getAveragePrice()).isNull(); assertThat(limitOrder.getCurrencyPair()) .isEqualTo(new CurrencyPair(Currency.BTC, Currency.KRW)); assertThat(limitOrder.getId()).isEqualTo("C0101000007408440032"); assertThat(limitOrder.getTimestamp()).isNotNull(); assertThat(limitOrder.getStatus()).isEqualTo(Order.OrderStatus.NEW); }