use of org.knowm.xchange.latoken.dto.marketdata.LatokenOrderbook in project XChange by knowm.
the class LatokenAdapters method adaptOrderBook.
public static OrderBook adaptOrderBook(Exchange exchange, LatokenOrderbook latokenOrderbook) {
CurrencyPair pair = adaptCurrencyPair(exchange, latokenOrderbook.getSymbol());
List<LimitOrder> asks = latokenOrderbook.getAsks().stream().map(level -> new LimitOrder.Builder(OrderType.ASK, pair).originalAmount(level.getAmount()).limitPrice(level.getPrice()).build()).collect(Collectors.toList());
List<LimitOrder> bids = latokenOrderbook.getBids().stream().map(level -> new LimitOrder.Builder(OrderType.BID, pair).originalAmount(level.getAmount()).limitPrice(level.getPrice()).build()).collect(Collectors.toList());
return new OrderBook(null, asks, bids);
}
use of org.knowm.xchange.latoken.dto.marketdata.LatokenOrderbook in project XChange by knowm.
the class LatokenMarketDataService method getOrderBook.
@Override
public OrderBook getOrderBook(CurrencyPair pair, Object... args) throws IOException {
try {
int depthLimit = maxOrderbookDepth;
if (args != null && args.length == 1) {
Object arg0 = args[0];
if (!(arg0 instanceof Integer)) {
throw new ExchangeException("Depth-limit must be an Integer!");
} else {
depthLimit = (Integer) arg0;
}
}
LatokenOrderbook latokenOrderbook = getLatokenOrderbook(pair, depthLimit);
return LatokenAdapters.adaptOrderBook(this.exchange, latokenOrderbook);
} catch (LatokenException e) {
throw LatokenErrorAdapter.adapt(e);
}
}
Aggregations