Search in sources :

Example 1 with BiboxTradeCommand

use of org.knowm.xchange.bibox.dto.trade.BiboxTradeCommand 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 2 with BiboxTradeCommand

use of org.knowm.xchange.bibox.dto.trade.BiboxTradeCommand 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)

Aggregations

BiboxException (org.knowm.xchange.bibox.BiboxException)2 BiboxTradeCommand (org.knowm.xchange.bibox.dto.trade.BiboxTradeCommand)2 ExchangeException (org.knowm.xchange.exceptions.ExchangeException)2