HitbtcTrade[] allHitbtcTrades = hitbtcTrades.getHitbtcTrades();
List<Trade> trades = new ArrayList<Trade>(allHitbtcTrades.length);
long lastTradeId = 0;
for (int i = 0; i < allHitbtcTrades.length; i++) {
HitbtcTrade hitbtcTrade = allHitbtcTrades[i];
Date timestamp = new Date(hitbtcTrade.getDate());
BigDecimal price = hitbtcTrade.getPrice();
BigDecimal amount = hitbtcTrade.getAmount();
String tid = hitbtcTrade.getTid();
long longTradeId = tid == null ? 0 : Long.parseLong(tid);
if (longTradeId > lastTradeId)
lastTradeId = longTradeId;
Trade trade = new Trade(null, amount, currencyPair, price, timestamp, tid);
trades.add(trade);