BitfinexTradeResponse[] responses = initTradeResponses();
Trades trades = BitfinexAdapters.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.getTradableAmount());
assertEquals(BitfinexAdapters.adaptCurrencyPair(SYMBOL), trade.getCurrencyPair());
assertEquals(expectedTimestampMillis, trade.getTimestamp().getTime());
assertEquals(expectedOrderType, trade.getType());
assertEquals(responses[i].getTradeId(), trade.getId());
}
}