use of org.knowm.xchange.exceptions.NotYetImplementedForExchangeException in project XChange by knowm.
the class CoingiAccountService method withdrawFunds.
@Override
public String withdrawFunds(WithdrawFundsParams p) throws IOException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException {
try {
if (p instanceof DefaultWithdrawFundsParams) {
DefaultWithdrawFundsParams params = (DefaultWithdrawFundsParams) p;
CoingiWithdrawalRequest request = new CoingiWithdrawalRequest().setAddress(params.address).setAmount(params.amount).setCurrency(params.currency.getCurrencyCode().toUpperCase());
return withdraw(request).toString();
}
throw new NotYetImplementedForExchangeException();
} catch (CoingiException e) {
throw CoingiErrorAdapter.adapt(e);
}
}
use of org.knowm.xchange.exceptions.NotYetImplementedForExchangeException in project XChange by knowm.
the class BitfinexTradeService method placeStopOrder.
@Override
public String placeStopOrder(StopOrder stopOrder) throws IOException {
if (stopOrder.getLimitPrice() != null) {
throw new NotYetImplementedForExchangeException("Limit stops are not supported by the Bitfinex v1 API.");
}
LimitOrder limitOrder = new LimitOrder(stopOrder.getType(), stopOrder.getOriginalAmount(), stopOrder.getCurrencyPair(), stopOrder.getId(), stopOrder.getTimestamp(), stopOrder.getStopPrice());
limitOrder.setOrderFlags(stopOrder.getOrderFlags());
limitOrder.setLeverage(stopOrder.getLeverage());
limitOrder.addOrderFlag(BitfinexOrderFlags.STOP);
return placeLimitOrder(limitOrder);
}
use of org.knowm.xchange.exceptions.NotYetImplementedForExchangeException 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.exceptions.NotYetImplementedForExchangeException in project XChange by knowm.
the class TradeDemo method generic.
private static void generic(TradeService tradeService) throws NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException {
printOpenOrders(tradeService);
// place a limit buy order
LimitOrder limitOrder = new LimitOrder(Order.OrderType.BID, BigDecimal.ONE, new CurrencyPair(Currency.GHs, Currency.BTC), "", null, new BigDecimal("0.00015600"));
System.out.println("Trying to place: " + limitOrder);
String orderId = "0";
try {
orderId = tradeService.placeLimitOrder(limitOrder);
System.out.println("New Limit Order ID: " + orderId);
} catch (ExchangeException e) {
System.out.println(e);
}
printOpenOrders(tradeService);
// Cancel the added order
boolean cancelResult = tradeService.cancelOrder(orderId);
System.out.println("Canceling order id=" + orderId + " returned " + cancelResult);
printOpenOrders(tradeService);
}
use of org.knowm.xchange.exceptions.NotYetImplementedForExchangeException in project XChange by knowm.
the class GeminiStreamingMarketDataService method getOrderBook.
@Override
public Observable<OrderBook> getOrderBook(CurrencyPair currencyPair, Object... args) {
int maxDepth = (int) MoreObjects.firstNonNull(args.length > 0 ? args[0] : null, 1);
Observable<GeminiOrderbook> subscribedOrderbookSnapshot = service.subscribeChannel(currencyPair, maxDepth, maxDepth).filter(s -> filterEventsByReason(s, "change", "initial") || filterEventsByReason(s, "change", "place") || filterEventsByReason(s, "change", "cancel") || filterEventsByReason(s, "change", "trade")).filter(// filter out updates that arrive before initial book
s -> orderbooks.get(currencyPair) != null || filterEventsByReason(s, "change", "initial")).map((JsonNode s) -> {
if (filterEventsByReason(s, "change", "initial")) {
GeminiWebSocketTransaction transaction = mapper.treeToValue(s, GeminiWebSocketTransaction.class);
GeminiOrderbook orderbook = transaction.toGeminiOrderbook(currencyPair);
orderbooks.put(currencyPair, orderbook);
return orderbook;
}
if (filterEventsByReason(s, "change", "place") || filterEventsByReason(s, "change", "cancel") || filterEventsByReason(s, "change", "trade")) {
GeminiWebSocketTransaction transaction = mapper.treeToValue(s, GeminiWebSocketTransaction.class);
GeminiLimitOrder[] levels = transaction.toGeminiLimitOrdersUpdate();
GeminiOrderbook orderbook = orderbooks.get(currencyPair);
orderbook.updateLevels(levels);
return orderbook;
}
throw new NotYetImplementedForExchangeException(" Unknown message type, even after filtering: " + s.toString());
});
return subscribedOrderbookSnapshot.map(geminiOrderbook -> GeminiAdaptersX.toOrderbook(geminiOrderbook, maxDepth, new Date()));
}
Aggregations