use of org.knowm.xchange.poloniex.dto.marketdata.PoloniexDepth in project XChange by knowm.
the class PoloniexMarketDataService method getOrderBook.
@Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws ExchangeException, IOException {
try {
PoloniexDepth depth = null;
// ~full order book
int depthLimit = 999999;
if (args != null && args.length > 0) {
if (args[0] instanceof Integer) {
depthLimit = (Integer) args[0];
} else {
throw new ExchangeException("Orderbook size argument must be an Integer!");
}
}
depth = getPoloniexDepth(currencyPair, depthLimit);
if (depth == null) {
depth = getPoloniexDepth(currencyPair);
}
return PoloniexAdapters.adaptPoloniexDepth(depth, currencyPair);
} catch (PoloniexException e) {
throw PoloniexErrorAdapter.adapt(e);
}
}
use of org.knowm.xchange.poloniex.dto.marketdata.PoloniexDepth in project XChange by knowm.
the class PoloniexOrderbook method toPoloniexDepth.
public PoloniexDepth toPoloniexDepth() {
PoloniexDepth orderbook = new PoloniexDepth();
List<List<BigDecimal>> poloniexDepthAsk = toPoloniexDepthLevels(asks);
List<List<BigDecimal>> poloniexDepthBid = toPoloniexDepthLevels(bids);
orderbook.setAsks(poloniexDepthAsk);
orderbook.setBids(poloniexDepthBid);
return orderbook;
}
Aggregations