use of org.knowm.xchange.bithumb.BithumbException in project XChange by knowm.
the class BithumbTradeService method cancelOrder.
@Override
public boolean cancelOrder(CancelOrderParams orderParams) throws IOException {
try {
if (!(orderParams instanceof CancelOrderByIdParams && orderParams instanceof CancelOrderByCurrencyPair)) {
throw new NotYetImplementedForExchangeException("Only CancelOrderByPairAndIdParams || (CancelOrderByIdParams && CancelOrderByCurrencyPair) supported");
}
String orderId = ((CancelOrderByIdParams) orderParams).getOrderId();
CurrencyPair pair = ((CancelOrderByCurrencyPair) orderParams).getCurrencyPair();
return cancelBithumbOrder(orderId, pair);
} catch (BithumbException e) {
throw BithumbErrorAdapter.adapt(e);
}
}
use of org.knowm.xchange.bithumb.BithumbException in project XChange by knowm.
the class BithumbTradeDemo method raw.
private static void raw(BithumbTradeServiceRaw tradeServiceRaw) throws IOException, InterruptedException {
log.debug("{}", "----------RAW----------");
final OpenOrdersParams openOrders = new DefaultOpenOrdersParamCurrencyPair(CURRENCY_PAIR);
try {
log.debug("{}", tradeServiceRaw.getBithumbOrders(CURRENCY_PAIR));
} catch (BithumbException e) {
log.debug("", e);
}
log.debug("{}", tradeServiceRaw.getBithumbUserTransactions(CURRENCY_PAIR));
final LimitOrder limitOrderBuy = new LimitOrder.Builder(Order.OrderType.BID, CURRENCY_PAIR).originalAmount(BigDecimal.valueOf(10)).limitPrice(BigDecimal.valueOf(100)).build();
log.debug("{}", tradeServiceRaw.placeBithumbLimitOrder(limitOrderBuy));
// wait for order to propagate
Thread.sleep(3000);
final LimitOrder limitOrderSell = new LimitOrder.Builder(Order.OrderType.ASK, CURRENCY_PAIR).originalAmount(BigDecimal.valueOf(10)).limitPrice(BigDecimal.valueOf(600)).build();
log.debug("{}", tradeServiceRaw.placeBithumbLimitOrder(limitOrderSell));
// wait for order to propagate
Thread.sleep(3000);
tradeServiceRaw.getBithumbOrders(CURRENCY_PAIR).getData().stream().map(BithumbOrder::getOrderId).forEach(orderId -> {
try {
log.debug("{}", tradeServiceRaw.cancelBithumbOrder(orderId, CURRENCY_PAIR));
} catch (IOException ignored) {
}
});
// log.debug("{}", tradeServiceRaw.placeBithumbMarketOrder(new
// MarketOrder(Order.OrderType.ASK, BigDecimal.valueOf(10), CURRENCY_PAIR)));
}
Aggregations