List<LimitOrder> askOrders = new ArrayList<LimitOrder>(asksLength);
List<LimitOrder> bidOrders = new ArrayList<LimitOrder>(bidsLength);
for (int i = asksLength - 1; i >= 0; i--) {
BigDecimal[] ask = asks[i];
LimitOrder order = new LimitOrder.Builder(OrderType.ASK, CurrencyPair.BTC_USD).limitPrice(ask[0]).tradableAmount(ask[1]).build();
askOrders.add(order);
}
for (int i = 0; i < bidsLength; i++) {
BigDecimal[] bid = bids[i];
LimitOrder order = new LimitOrder.Builder(OrderType.BID, CurrencyPair.BTC_USD).limitPrice(bid[0]).tradableAmount(bid[1]).build();
bidOrders.add(order);
}
return new OrderBook(timeStamp, askOrders, bidOrders);
}