GeminiAdapters { public static UserTrades adaptTradeHistory(GeminiTradeResponse[] trades, String symbol) { List<UserTrade> pastTrades = new ArrayList<>(trades.length); CurrencyPair currencyPair = adaptCurrencyPair(symbol); for (GeminiTradeResponse trade : trades) { OrderType orderType = trade.getType().equalsIgnoreCase("buy") ? OrderType.BID : OrderType.ASK; Date timestamp = convertBigDecimalTimestampToDate(trade.getTimestamp()); final BigDecimal fee = trade.getFeeAmount(); pastTrades.add( new UserTrade.Builder() .type(orderType) .originalAmount(trade.getAmount()) .currencyPair(currencyPair) .price(trade.getPrice()) .timestamp(timestamp) .id(trade.getTradeId()) .orderId(trade.getOrderId()) .feeAmount(fee) .feeCurrency(Currency.getInstance(trade.getFeeCurrency())) .build()); } return new UserTrades(pastTrades, TradeSortType.SortByTimestamp); } 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 testAdaptTradeHistory() { GeminiTradeResponse[] responses = initTradeResponses(); Trades trades = GeminiAdapters.adaptTradeHistory(responses, SYMBOL); assertEquals(trades.getTrades().size(), responses.length); for (int i = 0; i < responses.length; i++) { Trade trade = trades.getTrades().get(i); long expectedTimestampMillis = responses[i].getTimestamp().multiply(new BigDecimal(1000L)).longValue(); Order.OrderType expectedOrderType = responses[i].getType().equalsIgnoreCase("buy") ? OrderType.BID : OrderType.ASK; assertEquals(responses[i].getPrice(), trade.getPrice()); assertEquals(responses[i].getAmount(), trade.getOriginalAmount()); assertEquals(GeminiAdapters.adaptCurrencyPair(SYMBOL), trade.getCurrencyPair()); assertEquals(expectedTimestampMillis, trade.getTimestamp().getTime()); assertEquals(expectedOrderType, trade.getType()); assertEquals(responses[i].getTradeId(), trade.getId()); } }