public static Trade adaptTrade(TheRockTrade trade, CurrencyPair currencyPair)
     throws InvalidFormatException {
   final String tradeId = String.valueOf(trade.getId());
   return new Trade(
       trade.getSide() == Side.sell ? OrderType.ASK : BID,
       trade.getAmount(),
       currencyPair,
       trade.getPrice(),
       trade.getDate(),
       tradeId);
 }
  public static Trades adaptTrades(TheRockTrades trades, CurrencyPair currencyPair)
      throws InvalidFormatException {

    List<Trade> tradesList = new ArrayList<Trade>(trades.getCount());
    long lastTradeId = 0;
    for (int i = 0; i < trades.getCount(); i++) {
      TheRockTrade trade = trades.getTrades()[i];
      long tradeId = trade.getId();
      if (tradeId > lastTradeId) lastTradeId = tradeId;
      tradesList.add(adaptTrade(trade, currencyPair));
    }
    return new Trades(tradesList, lastTradeId, Trades.TradeSortType.SortByID);
  }