Search in sources :

Example 1 with OrderCancellationRequest

use of org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationRequest 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;
}
Also used : OrderCancellationRequest(org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationRequest) OrderCancellationResponse(org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationResponse) CancelOrderByIdParams(org.knowm.xchange.service.trade.params.CancelOrderByIdParams) CancelOrderByCurrencyPair(org.knowm.xchange.service.trade.params.CancelOrderByCurrencyPair)

Example 2 with OrderCancellationRequest

use of org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationRequest in project XChange by knowm.

the class OkexTradeServiceRaw method spotCancelOrder.

public OrderCancellationResponse spotCancelOrder(String orderId, OrderCancellationRequest req) throws IOException {
    OrderCancellationResponse res = okex.spotCancelOrder(apikey, digest, timestamp(), passphrase, orderId, req);
    res.checkResult();
    return res;
}
Also used : FuturesMultipleOrderCancellationResponse(org.knowm.xchange.okcoin.v3.dto.trade.FuturesMultipleOrderCancellationResponse) OrderCancellationResponse(org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationResponse) SwapMultipleOrderCancellationResponse(org.knowm.xchange.okcoin.v3.dto.trade.SwapMultipleOrderCancellationResponse)

Aggregations

OrderCancellationResponse (org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationResponse)2 FuturesMultipleOrderCancellationResponse (org.knowm.xchange.okcoin.v3.dto.trade.FuturesMultipleOrderCancellationResponse)1 OrderCancellationRequest (org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationRequest)1 SwapMultipleOrderCancellationResponse (org.knowm.xchange.okcoin.v3.dto.trade.SwapMultipleOrderCancellationResponse)1 CancelOrderByCurrencyPair (org.knowm.xchange.service.trade.params.CancelOrderByCurrencyPair)1 CancelOrderByIdParams (org.knowm.xchange.service.trade.params.CancelOrderByIdParams)1