Search in sources :

Example 1 with OrderCancellationResponse

use of org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationResponse 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 OrderCancellationResponse

use of org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationResponse 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)

Example 3 with OrderCancellationResponse

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

the class OkexTradeServiceRaw method futuresCancelOrder.

public OrderCancellationResponse futuresCancelOrder(String instrumentId, String orderId) throws IOException {
    OrderCancellationResponse res = okex.futuresCancelOrder(apikey, digest, timestamp(), passphrase, instrumentId, orderId);
    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)

Example 4 with OrderCancellationResponse

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

the class OkexTradeServiceRaw method swapCancelOrder.

public OrderCancellationResponse swapCancelOrder(String instrumentId, String orderId) throws IOException {
    OrderCancellationResponse res = okex.swapCancelOrder(apikey, digest, timestamp(), passphrase, instrumentId, orderId);
    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)4 FuturesMultipleOrderCancellationResponse (org.knowm.xchange.okcoin.v3.dto.trade.FuturesMultipleOrderCancellationResponse)3 SwapMultipleOrderCancellationResponse (org.knowm.xchange.okcoin.v3.dto.trade.SwapMultipleOrderCancellationResponse)3 OrderCancellationRequest (org.knowm.xchange.okcoin.v3.dto.trade.OrderCancellationRequest)1 CancelOrderByCurrencyPair (org.knowm.xchange.service.trade.params.CancelOrderByCurrencyPair)1 CancelOrderByIdParams (org.knowm.xchange.service.trade.params.CancelOrderByIdParams)1