Search in sources :

Example 11 with BiboxException

use of org.knowm.xchange.bibox.BiboxException in project XChange by knowm.

the class BiboxTradeServiceRaw method placeBiboxMarketOrder.

public String placeBiboxMarketOrder(MarketOrder marketOrder) {
    try {
        BiboxTradeCommand cmd = new BiboxTradeCommand(BiboxAdapters.toBiboxPair(marketOrder.getCurrencyPair()), BiboxAccountType.REGULAR.asInt(), BiboxOrderType.MARKET_ORDER.asInt(), BiboxOrderSide.fromOrderType(marketOrder.getType()).asInt(), true, null, marketOrder.getOriginalAmount(), null);
        BiboxSingleResponse<String> response = bibox.trade(BiboxCommands.of(cmd).json(), apiKey, signatureCreator);
        throwErrors(response);
        return response.get().getResult();
    } catch (BiboxException e) {
        throw new ExchangeException(e.getMessage());
    }
}
Also used : BiboxTradeCommand(org.knowm.xchange.bibox.dto.trade.BiboxTradeCommand) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) BiboxException(org.knowm.xchange.bibox.BiboxException)

Example 12 with BiboxException

use of org.knowm.xchange.bibox.BiboxException in project XChange by knowm.

the class BiboxTradeServiceRaw method placeBiboxLimitOrder.

public String placeBiboxLimitOrder(LimitOrder limitOrder) {
    try {
        BiboxTradeCommand cmd = new BiboxTradeCommand(BiboxAdapters.toBiboxPair(limitOrder.getCurrencyPair()), BiboxAccountType.REGULAR.asInt(), BiboxOrderType.LIMIT_ORDER.asInt(), BiboxOrderSide.fromOrderType(limitOrder.getType()).asInt(), true, limitOrder.getLimitPrice(), limitOrder.getOriginalAmount(), null);
        BiboxSingleResponse<String> response = bibox.trade(BiboxCommands.of(cmd).json(), apiKey, signatureCreator);
        throwErrors(response);
        return response.get().getResult();
    } catch (BiboxException e) {
        throw new ExchangeException(e.getMessage());
    }
}
Also used : BiboxTradeCommand(org.knowm.xchange.bibox.dto.trade.BiboxTradeCommand) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) BiboxException(org.knowm.xchange.bibox.BiboxException)

Example 13 with BiboxException

use of org.knowm.xchange.bibox.BiboxException in project XChange by knowm.

the class BiboxTradeServiceRaw method cancelBiboxOrders.

public void cancelBiboxOrders(List<String> orderIds) {
    try {
        List<BiboxCommand<?>> cmds = orderIds.stream().map(BiboxCancelTradeCommand::new).collect(Collectors.toList());
        BiboxMultipleResponses<String> response = bibox.cancelTrades(BiboxCommands.of(cmds).json(), apiKey, signatureCreator);
        throwErrors(response);
    } catch (BiboxException e) {
        throw new ExchangeException(e.getMessage());
    }
}
Also used : BiboxCommand(org.knowm.xchange.bibox.dto.BiboxCommand) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) BiboxException(org.knowm.xchange.bibox.BiboxException)

Example 14 with BiboxException

use of org.knowm.xchange.bibox.BiboxException in project XChange by knowm.

the class BiboxTradeServiceRaw method getBiboxOpenOrders.

public BiboxOrders getBiboxOpenOrders(Integer page) {
    try {
        BiboxOrderPendingListCommandBody body = new BiboxOrderPendingListCommandBody(page == null ? 1 : page, // wonder if this actually works
        Integer.MAX_VALUE);
        BiboxOrderPendingListCommand cmd = new BiboxOrderPendingListCommand(body);
        BiboxSingleResponse<BiboxOrders> response = bibox.orderPendingList(BiboxCommands.of(cmd).json(), apiKey, signatureCreator);
        throwErrors(response);
        return response.get().getResult();
    } catch (BiboxException e) {
        throw new ExchangeException(e.getMessage());
    }
}
Also used : BiboxOrders(org.knowm.xchange.bibox.dto.trade.BiboxOrders) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) BiboxOrderPendingListCommand(org.knowm.xchange.bibox.dto.trade.BiboxOrderPendingListCommand) BiboxOrderPendingListCommandBody(org.knowm.xchange.bibox.dto.trade.BiboxOrderPendingListCommandBody) BiboxException(org.knowm.xchange.bibox.BiboxException)

Example 15 with BiboxException

use of org.knowm.xchange.bibox.BiboxException in project XChange by knowm.

the class BiboxTradeServiceRaw method cancelBiboxOrder.

public void cancelBiboxOrder(String orderId) {
    try {
        BiboxCancelTradeCommand cmd = new BiboxCancelTradeCommand(orderId);
        BiboxSingleResponse<String> response = bibox.cancelTrade(BiboxCommands.of(cmd).json(), apiKey, signatureCreator);
        throwErrors(response);
    } catch (BiboxException e) {
        throw new ExchangeException(e.getMessage());
    }
}
Also used : ExchangeException(org.knowm.xchange.exceptions.ExchangeException) BiboxCancelTradeCommand(org.knowm.xchange.bibox.dto.trade.BiboxCancelTradeCommand) BiboxException(org.knowm.xchange.bibox.BiboxException)

Aggregations

BiboxException (org.knowm.xchange.bibox.BiboxException)16 ExchangeException (org.knowm.xchange.exceptions.ExchangeException)16 List (java.util.List)3 BiboxCommand (org.knowm.xchange.bibox.dto.BiboxCommand)2 BiboxTicker (org.knowm.xchange.bibox.dto.marketdata.BiboxTicker)2 BiboxOrderBook (org.knowm.xchange.bibox.dto.trade.BiboxOrderBook)2 BiboxOrderPendingListCommandBody (org.knowm.xchange.bibox.dto.trade.BiboxOrderPendingListCommandBody)2 BiboxOrders (org.knowm.xchange.bibox.dto.trade.BiboxOrders)2 BiboxTradeCommand (org.knowm.xchange.bibox.dto.trade.BiboxTradeCommand)2 IOException (java.io.IOException)1 Collection (java.util.Collection)1 Objects (java.util.Objects)1 Collectors (java.util.stream.Collectors)1 Exchange (org.knowm.xchange.Exchange)1 BiboxAdapters (org.knowm.xchange.bibox.dto.BiboxAdapters)1 BiboxAdapters.toBiboxPair (org.knowm.xchange.bibox.dto.BiboxAdapters.toBiboxPair)1 BiboxCommands (org.knowm.xchange.bibox.dto.BiboxCommands)1 BiboxMultipleResponses (org.knowm.xchange.bibox.dto.BiboxMultipleResponses)1 BiboxResponse (org.knowm.xchange.bibox.dto.BiboxResponse)1 BiboxAssetsResult (org.knowm.xchange.bibox.dto.account.BiboxAssetsResult)1