use of org.knowm.xchange.service.trade.params.CancelOrderByInstrument in project XChange by knowm.
the class OkexTradeService method cancelOrder.
@Override
public boolean cancelOrder(CancelOrderParams params) throws IOException {
if (params instanceof CancelOrderByIdParams && params instanceof CancelOrderByInstrument) {
String id = ((CancelOrderByIdParams) params).getOrderId();
String instrumentId = OkexAdapters.adaptInstrumentId(((CancelOrderByInstrument) params).getInstrument());
OkexCancelOrderRequest req = OkexCancelOrderRequest.builder().instrumentId(instrumentId).orderId(id).build();
return "0".equals(cancelOkexOrder(req).getData().get(0).getCode());
} else {
throw new IOException("CancelOrderParams must implement CancelOrderByIdParams and CancelOrderByInstrument interface.");
}
}
Aggregations