use of org.knowm.xchange.service.trade.params.CancelOrderByIdParams in project XChange by knowm.
the class LatokenTradeService method cancelOrder.
@Override
public boolean cancelOrder(CancelOrderParams params) throws IOException {
if (params instanceof CancelOrderByIdParams == false) {
throw new ExchangeException("OrderId must be provided to cancel an order.");
}
CancelOrderByIdParams paramId = (CancelOrderByIdParams) params;
String orderId = paramId.getOrderId();
if (orderId == null) {
throw new ExchangeException("OrderId must be provided to cancel an order.");
}
return cancelOrder(orderId);
}
use of org.knowm.xchange.service.trade.params.CancelOrderByIdParams in project XChange by knowm.
the class BinanceTradeService method cancelOrder.
@Override
public boolean cancelOrder(CancelOrderParams params) throws IOException {
try {
if (!(params instanceof CancelOrderByCurrencyPair) && !(params instanceof CancelOrderByIdParams)) {
throw new ExchangeException("You need to provide the currency pair and the order id to cancel an order.");
}
CancelOrderByCurrencyPair paramCurrencyPair = (CancelOrderByCurrencyPair) params;
CancelOrderByIdParams paramId = (CancelOrderByIdParams) params;
super.cancelOrder(paramCurrencyPair.getCurrencyPair(), BinanceAdapters.id(paramId.getOrderId()), null, null);
return true;
} catch (BinanceException e) {
throw BinanceErrorAdapter.adapt(e);
}
}
use of org.knowm.xchange.service.trade.params.CancelOrderByIdParams in project XChange by knowm.
the class OkexTradeService method cancelOrder.
@Override
public boolean cancelOrder(CancelOrderParams orderParams) throws IOException {
if (!(orderParams instanceof CancelOrderByIdParams) || !(orderParams instanceof CancelOrderByCurrencyPair)) {
throw new UnsupportedOperationException("Cancelling an order is only available for a single market and a single id.");
}
String id = ((CancelOrderByIdParams) orderParams).getOrderId();
String instrumentId = OkexAdaptersV3.toSpotInstrument(((CancelOrderByCurrencyPair) orderParams).getCurrencyPair());
OrderCancellationRequest req = OrderCancellationRequest.builder().instrumentId(instrumentId).build();
OrderCancellationResponse o = spotCancelOrder(id, req);
return true;
}
use of org.knowm.xchange.service.trade.params.CancelOrderByIdParams in project XChange by knowm.
the class ExmoTradeService method cancelOrder.
@Override
public boolean cancelOrder(CancelOrderParams orderParams) throws IOException {
if (orderParams instanceof CancelOrderByIdParams) {
CancelOrderByIdParams params = (CancelOrderByIdParams) orderParams;
String orderId = params.getOrderId();
Map map = exmo.orderCancel(signatureCreator, apiKey, exchange.getNonceFactory(), orderId);
return (boolean) map.get("result");
}
return false;
}
use of org.knowm.xchange.service.trade.params.CancelOrderByIdParams in project XChange by knowm.
the class BithumbTradeService method cancelOrder.
@Override
public boolean cancelOrder(CancelOrderParams orderParams) throws IOException {
try {
if (!(orderParams instanceof CancelOrderByIdParams && orderParams instanceof CancelOrderByCurrencyPair)) {
throw new NotYetImplementedForExchangeException("Only CancelOrderByPairAndIdParams || (CancelOrderByIdParams && CancelOrderByCurrencyPair) supported");
}
String orderId = ((CancelOrderByIdParams) orderParams).getOrderId();
CurrencyPair pair = ((CancelOrderByCurrencyPair) orderParams).getCurrencyPair();
return cancelBithumbOrder(orderId, pair);
} catch (BithumbException e) {
throw BithumbErrorAdapter.adapt(e);
}
}
Aggregations