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());
}
}
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());
}
}
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());
}
}
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());
}
}
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());
}
}
Aggregations