CoinbaseProAdapters { @SuppressWarnings("unchecked") public static OpenOrders adaptOpenOrders(CoinbaseProOrder[] coinbaseExOpenOrders) { Stream<Order> orders = Arrays.asList(coinbaseExOpenOrders).stream().map(CoinbaseProAdapters::adaptOrder); Map<Boolean, List<Order>> twoTypes = orders.collect(Collectors.partitioningBy(t -> t instanceof LimitOrder)); @SuppressWarnings("rawtypes") List limitOrders = twoTypes.get(true); return new OpenOrders(limitOrders, twoTypes.get(false)); } private  CoinbaseProAdapters(); static CurrencyPair toCurrencyPair(final String productId); static Ticker adaptTicker(
      CoinbaseProProductTicker ticker, CoinbaseProProductStats stats, CurrencyPair currencyPair); static OrderBook adaptOrderBook(
      CoinbaseProProductBook book, CurrencyPair currencyPair, Date date); static OrderBook adaptOrderBook(CoinbaseProProductBook book, CurrencyPair currencyPair); static Wallet adaptAccountInfo(CoinbaseProAccount[] coinbaseProAccounts); @SuppressWarnings("unchecked") static OpenOrders adaptOpenOrders(CoinbaseProOrder[] coinbaseExOpenOrders); static Order adaptOrder(CoinbaseProOrder order); static OrderStatus[] adaptOrderStatuses(CoinbaseProOrder[] orders); static OrderStatus adaptOrderStatus(CoinbaseProOrder order); static Trades adaptTrades(
      List<CoinbaseProTrade> coinbaseProTradesList, CurrencyPair currencyPair); static UserTrades adaptTradeHistory(CoinbaseProFill[] coinbaseExFills); static Trades adaptTrades(CoinbaseProTrade[] coinbaseExTrades, CurrencyPair currencyPair); static CurrencyPair adaptCurrencyPair(CoinbaseProProduct product); static ExchangeMetaData adaptToExchangeMetaData(
      ExchangeMetaData exchangeMetaData,
      CoinbaseProProduct[] products,
      CoinbaseProCurrency[] cbCurrencies); static String adaptProductID(CurrencyPair currencyPair); static CoinbaseProPlaceOrder.Side adaptSide(OrderType orderType); static CoinbaseProPlaceOrder.Stop adaptStop(OrderType orderType); static CoinbaseProPlaceLimitOrder adaptCoinbaseProPlaceLimitOrder(LimitOrder limitOrder); static CoinbaseProPlaceMarketOrder adaptCoinbaseProPlaceMarketOrder(
      MarketOrder marketOrder); static CoinbaseProPlaceOrder adaptCoinbaseProStopOrder(StopOrder stopOrder); static FundingRecord adaptFundingRecord(
      Currency currency, CoinbaseProTransfer coinbaseProTransfer);  }
@Test public void testOrders() throws JsonParseException, JsonMappingException, IOException { final JacksonObjectMapperFactory factory = new DefaultJacksonObjectMapperFactory(); final ObjectMapper mapper = factory.createObjectMapper(); InputStream is = new SequenceInputStream( IOUtils.toInputStream("[", StandardCharsets.UTF_8), new SequenceInputStream( getClass() .getResourceAsStream( "/org/knowm/xchange/coinbasepro/dto/order/example-limit-order-pending.json"), new SequenceInputStream( IOUtils.toInputStream(", ", StandardCharsets.UTF_8), new SequenceInputStream( getClass() .getResourceAsStream( "/org/knowm/xchange/coinbasepro/dto/order/example-stop-order-filled.json"), IOUtils.toInputStream("]", StandardCharsets.UTF_8))))); final CoinbaseProOrder[] coinbaseProOrders = mapper.readValue(is, CoinbaseProOrder[].class); OpenOrders openOrders = CoinbaseProAdapters.adaptOpenOrders(coinbaseProOrders); assertThat(openOrders.getOpenOrders()).hasSize(1); assertThat(openOrders.getHiddenOrders()).hasSize(1); assertStopOrderFilled(openOrders.getHiddenOrders().get(0)); assertLimitOrderPending(openOrders.getOpenOrders().get(0)); }