@Override public boolean cancelOrder(CancelOrderParams params) throws IOException { if (!(params instanceof CancelOrderByIdParams)) { return false; } CancelOrderByIdParams paramId = (CancelOrderByIdParams) params; CurrencyPair currencyPair; if (params instanceof CancelOrderByCurrencyPair) { CancelOrderByCurrencyPair paramCurrencyPair = (CancelOrderByCurrencyPair) params; currencyPair = paramCurrencyPair.getCurrencyPair(); } else { currencyPair = null; } return cancelOrder(currencyPair, paramId.getOrderId()); }
@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."); } long id = Long.valueOf(((CancelOrderByIdParams) orderParams).getOrderId()); String symbol = OkCoinAdapters.adaptSymbol(((CancelOrderByCurrencyPair) orderParams).getCurrencyPair()); OkCoinTradeResult cancelResult = cancelOrder(id, symbol); return id == cancelResult.getOrderId(); }
@Override public boolean cancelOrder(CancelOrderParams orderParams) throws IOException { if (orderParams instanceof CancelOrderByCurrencyPair) { CancelOrderByCurrencyPair cob = (CancelOrderByCurrencyPair) orderParams; deleteAllAbucoinsOrders(AbucoinsAdapters.adaptCurrencyPairToProductID(cob.getCurrencyPair())); return true; } else { throw new NotYetImplementedForExchangeException("Only CancelOrderByCurrencyPair supported"); } }
public boolean cancelOrder(CancelOrderParams params) throws IOException { 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; LivecoinCancelResponse response = service.cancelLimitOrder( apiKey, signatureCreator, paramCurrencyPair.getCurrencyPair().toString(), Long.valueOf(paramId.getOrderId())); return response.isCancelled(); }
@Override public boolean cancelOrder(CancelOrderParams orderParams) throws IOException { if ((orderParams instanceof CancelOrderByIdParams) && (orderParams instanceof CancelOrderByCurrencyPair)) { String id = ((CancelOrderByIdParams) orderParams).getOrderId(); String coin = ((CancelOrderByCurrencyPair) orderParams) .getCurrencyPair() .base .getCurrencyCode() .toLowerCase(); return CoinEggAdapters.adaptTradeCancel(getCoinEggTradeCancel(id, coin)); } throw new ExchangeException("Incorrect CancelOrderParams!"); }
@Override public boolean cancelOrder(CancelOrderParams orderParams) throws IOException { if (!(orderParams instanceof CancelOrderByCurrencyPair) && !(orderParams instanceof CancelOrderByIdParams) && !(orderParams instanceof CancelOrderByOrderTypeParams)) { throw new ExchangeException( "You need to provide the currency pair, the order id and the order type to cancel an order."); } return cancelKucoinOrder( ((CancelOrderByCurrencyPair) orderParams).getCurrencyPair(), ((CancelOrderByIdParams) orderParams).getOrderId(), ((CancelOrderByOrderTypeParams) orderParams).getOrderType()) .isSuccess(); }
@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; }
@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; Long recvWindow = (Long) exchange.getExchangeSpecification().getExchangeSpecificParametersItem("recvWindow"); super.cancelOrder( paramCurrencyPair.getCurrencyPair(), BinanceAdapters.id(paramId.getOrderId()), null, null, recvWindow, getTimestamp()); return true; } catch (BinanceException e) { throw BinanceErrorAdapter.adapt(e); } }
@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."); } long id = Long.valueOf(((CancelOrderByIdParams) orderParams).getOrderId()); String symbol = OkCoinAdapters.adaptSymbol(((CancelOrderByCurrencyPair) orderParams).getCurrencyPair()); OkCoinTradeResult cancelResult = cancelOrder(id, symbol); return id == cancelResult.getOrderId(); }
@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; Long recvWindow = (Long) exchange.getExchangeSpecification().getExchangeSpecificParametersItem("recvWindow"); super.cancelOrder( paramCurrencyPair.getCurrencyPair(), BinanceAdapters.id(paramId.getOrderId()), null, null, recvWindow, getTimestamp()); return true; } catch (BinanceException e) { throw BinanceErrorAdapter.adapt(e); } }