OpenOrders openOrders = PoloniexAdapters.adaptPoloniexOpenOrders(returnOpenOrders());
for (LimitOrder order : openOrders.getOpenOrders()) {
if (order.getId().equals(orderId)) {
HashMap<String, String> response = poloniex.cancelOrder(apiKey, signatureCreator, String.valueOf(nextNonce()), orderId, PoloniexUtils.toPairString(order.getCurrencyPair()));
if (response.containsKey("error")) {
throw new ExchangeException(response.get("error"));
}
else {
return response.get("success").toString().equals(new Integer(1).toString()) ? true : false;
}
}
}
throw new ExchangeException("Unable to find order #" + orderId);
}