use of org.knowm.xchange.dragonex.dto.trade.OrderHistory in project XChange by knowm.
the class DragonexTradeService method getOpenOrders.
@Override
public OpenOrders getOpenOrders(OpenOrdersParams params) throws IOException {
if (!(params instanceof OpenOrdersParamCurrencyPair)) {
throw new ExchangeException("You need to provide the currency pair.");
}
OpenOrdersParamCurrencyPair pairParams = (OpenOrdersParamCurrencyPair) params;
if (pairParams.getCurrencyPair() == null) {
throw new ExchangeException("You need to provide the currency pair.");
}
long symbolId = exchange.symbolId(pairParams.getCurrencyPair());
OrderHistoryRequest req = new OrderHistoryRequest(symbolId, null, null, 1000, 1);
OrderHistory orderHistory = super.orderHistory(exchange.getOrCreateToken().token, req);
List<LimitOrder> openOrders = orderHistory.getList().stream().map(o -> new LimitOrder(o.orderType == 1 ? OrderType.BID : OrderType.ASK, o.volume, exchange.pair(o.symbolId), Long.toString(o.orderId), o.getTimestamp(), o.price)).collect(Collectors.toList());
return new OpenOrders(openOrders);
}
Aggregations