GeminiAdapters { public static OrdersContainer adaptOrders( GeminiLevel[] GeminiLevels, CurrencyPair currencyPair, OrderType orderType) { BigDecimal maxTimestamp = new BigDecimal(Long.MIN_VALUE); List<LimitOrder> limitOrders = new ArrayList<>(GeminiLevels.length); for (GeminiLevel GeminiLevel : GeminiLevels) { if (GeminiLevel.getTimestamp().compareTo(maxTimestamp) > 0) { maxTimestamp = GeminiLevel.getTimestamp(); } Date timestamp = convertBigDecimalTimestampToDate(GeminiLevel.getTimestamp()); limitOrders.add( adaptOrder( GeminiLevel.getAmount(), GeminiLevel.getPrice(), currencyPair, orderType, timestamp)); } long maxTimestampInMillis = maxTimestamp.multiply(new BigDecimal(1000L)).longValue(); return new OrdersContainer(maxTimestampInMillis, limitOrders); } private  GeminiAdapters(); static List<CurrencyPair> adaptCurrencyPairs(Collection<String> GeminiSymbol); static CurrencyPair adaptCurrencyPair(String symbol); static String adaptCurrencyPair(CurrencyPair pair); static OrderBook adaptOrderBook(GeminiDepth btceDepth, CurrencyPair currencyPair); static OrdersContainer adaptOrders(
      GeminiLevel[] GeminiLevels, CurrencyPair currencyPair, OrderType orderType); static Order adaptOrder(GeminiOrderStatusResponse geminiOrderStatusResponse); static LimitOrder adaptOrder(
      BigDecimal amount,
      BigDecimal price,
      CurrencyPair currencyPair,
      OrderType orderType,
      Date timestamp); static List<FixedRateLoanOrder> adaptFixedRateLoanOrders(
      GeminiLendLevel[] orders, String currency, String orderType, String id); static FixedRateLoanOrder adaptFixedRateLoanOrder(
      String currency,
      BigDecimal amount,
      int dayPeriod,
      String direction,
      String id,
      BigDecimal rate); static List<FloatingRateLoanOrder> adaptFloatingRateLoanOrders(
      GeminiLendLevel[] orders, String currency, String orderType, String id); static FloatingRateLoanOrder adaptFloatingRateLoanOrder(
      String currency,
      BigDecimal amount,
      int dayPeriod,
      String direction,
      String id,
      BigDecimal rate); static Trade adaptTrade(GeminiTrade trade, CurrencyPair currencyPair); static Trades adaptTrades(GeminiTrade[] trades, CurrencyPair currencyPair); static Ticker adaptTicker(GeminiTicker GeminiTicker, CurrencyPair currencyPair); static Wallet adaptWallet(GeminiBalancesResponse[] response); static OpenOrders adaptOrders(GeminiOrderStatusResponse[] activeOrders); static UserTrades adaptTradeHistory(GeminiTradeResponse[] trades, String symbol); static ExchangeMetaData adaptMetaData(
      List<CurrencyPair> currencyPairs, ExchangeMetaData metaData); static Map<CurrencyPair, Fee> AdaptDynamicTradingFees(
      GeminiTrailingVolumeResponse volumeResponse, List<CurrencyPair> currencyPairs); static FundingRecord adapt(GeminiTransfer transfer); static final Logger log; }
@Test public void testAdaptOrdersToOrdersContainer() { GeminiLevel[] levels = initLevels(); GeminiAdapters.OrdersContainer container = GeminiAdapters.adaptOrders(levels, CurrencyPair.BTC_USD, OrderType.BID); GeminiLevel lastLevel = levels[levels.length - 1]; assertEquals( lastLevel.getTimestamp().multiply(new BigDecimal(1000L)).longValue(), container.getTimestamp()); assertEquals(container.getLimitOrders().size(), levels.length); for (int i = 0; i < levels.length; i++) { LimitOrder order = container.getLimitOrders().get(i); long expectedTimestampMillis = levels[i].getTimestamp().multiply(new BigDecimal(1000L)).longValue(); assertEquals(levels[i].getAmount(), order.getOriginalAmount()); assertEquals(expectedTimestampMillis, order.getTimestamp().getTime()); assertEquals(levels[i].getPrice(), order.getLimitPrice()); } }