use of org.knowm.xchange.dragonex.dto.trade.OrderReference in project XChange by knowm.
the class DragonexTradeService method cancelOrder.
@Override
public boolean cancelOrder(CancelOrderParams params) throws IOException {
if (!(params instanceof CancelOrderByCurrencyPair)) {
throw new ExchangeException("You need to provide the currency pair.");
}
if (!(params instanceof CancelOrderByIdParams)) {
throw new ExchangeException("You need to provide the order id.");
}
CurrencyPair pair = ((CancelOrderByCurrencyPair) params).getCurrencyPair();
if (pair == null) {
throw new ExchangeException("You need to provide the currency pair.");
}
long orderId;
try {
orderId = Long.valueOf(((CancelOrderByIdParams) params).getOrderId());
} catch (Throwable e) {
throw new ExchangeException("You need to provide the order id as a number.", e);
}
OrderReference ref = new OrderReference(exchange.symbolId(pair), orderId);
UserOrder order = super.orderCancel(exchange.getOrCreateToken().token, ref);
return order.status == 3;
}
Aggregations