Search in sources :

Example 1 with EXXCancelOrderByCurrencyPair

use of org.knowm.xchange.exx.dto.params.EXXCancelOrderByCurrencyPair in project XChange by knowm.

the class EXXTradeService method cancelOrder.

@Override
public boolean cancelOrder(CancelOrderParams cancelOrderParams) throws IOException {
    if (!(cancelOrderParams instanceof CancelOrderParams) && !(cancelOrderParams instanceof EXXCancelOrderByCurrencyPair)) {
        throw new ExchangeException("You need to provide the currency pair and the order id to cancel an order.");
    }
    EXXCancelOrderByCurrencyPair params = (EXXCancelOrderByCurrencyPair) cancelOrderParams;
    CurrencyPair currencyPair = params.getCurrencyPair();
    // etp_btc
    String currency = currencyPairFormat(currencyPair);
    return cancelExxOrder(params.getId(), currency);
}
Also used : CancelOrderParams(org.knowm.xchange.service.trade.params.CancelOrderParams) EXXCancelOrderByCurrencyPair(org.knowm.xchange.exx.dto.params.EXXCancelOrderByCurrencyPair) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) EXXCancelOrderByCurrencyPair(org.knowm.xchange.exx.dto.params.EXXCancelOrderByCurrencyPair) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Example 2 with EXXCancelOrderByCurrencyPair

use of org.knowm.xchange.exx.dto.params.EXXCancelOrderByCurrencyPair in project XChange by knowm.

the class TradeServiceIntegration method cancelOrder.

private static void cancelOrder() throws IOException {
    Exchange exx = getExchange();
    TradeService tradeService = exx.getTradeService();
    try {
        EXXCancelOrderByCurrencyPair exxCancelOrderByCurrencyPair = new EXXCancelOrderByCurrencyPair();
        exxCancelOrderByCurrencyPair.setCurrencyPair(CurrencyPair.ETH_BTC);
        exxCancelOrderByCurrencyPair.setId("634");
        boolean result = tradeService.cancelOrder(exxCancelOrderByCurrencyPair);
        System.out.println("cancelOrder result: " + result);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : Exchange(org.knowm.xchange.Exchange) EXXExchange(org.knowm.xchange.exx.EXXExchange) EXXCancelOrderByCurrencyPair(org.knowm.xchange.exx.dto.params.EXXCancelOrderByCurrencyPair) TradeService(org.knowm.xchange.service.trade.TradeService) IOException(java.io.IOException)

Aggregations

EXXCancelOrderByCurrencyPair (org.knowm.xchange.exx.dto.params.EXXCancelOrderByCurrencyPair)2 IOException (java.io.IOException)1 Exchange (org.knowm.xchange.Exchange)1 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)1 ExchangeException (org.knowm.xchange.exceptions.ExchangeException)1 EXXExchange (org.knowm.xchange.exx.EXXExchange)1 TradeService (org.knowm.xchange.service.trade.TradeService)1 CancelOrderParams (org.knowm.xchange.service.trade.params.CancelOrderParams)1