use of org.knowm.xchange.service.trade.params.DefaultWithdrawFundsParams 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.service.trade.params.DefaultWithdrawFundsParams in project XChange by knowm.
the class BitbayAccountService method withdrawFunds.
@Override
public String withdrawFunds(WithdrawFundsParams params) throws IOException {
if (params instanceof DefaultWithdrawFundsParams) {
DefaultWithdrawFundsParams defaultParams = (DefaultWithdrawFundsParams) params;
transfer(defaultParams.getCurrency(), defaultParams.getAmount(), defaultParams.getAddress());
return "Success";
} else if (params instanceof BitbayWithdrawFundsSwiftParams) {
BitbayWithdrawFundsSwiftParams bicParams = (BitbayWithdrawFundsSwiftParams) params;
withdraw(bicParams.getCurrency(), bicParams.getAmount(), bicParams.getAccount(), bicParams.isExpress(), bicParams.getBic());
return "Success";
}
throw new NotAvailableFromExchangeException();
}
use of org.knowm.xchange.service.trade.params.DefaultWithdrawFundsParams in project XChange by knowm.
the class BinanceAccountService method withdrawFunds.
@Override
public String withdrawFunds(WithdrawFundsParams params) throws IOException {
try {
if (!(params instanceof DefaultWithdrawFundsParams)) {
throw new IllegalArgumentException("DefaultWithdrawFundsParams must be provided.");
}
WithdrawResponse withdraw;
if (params instanceof RippleWithdrawFundsParams) {
RippleWithdrawFundsParams rippleParams = null;
rippleParams = (RippleWithdrawFundsParams) params;
withdraw = super.withdraw(rippleParams.getCurrency().getCurrencyCode(), rippleParams.getAddress(), rippleParams.getTag(), rippleParams.getAmount());
} else {
DefaultWithdrawFundsParams p = (DefaultWithdrawFundsParams) params;
withdraw = super.withdraw(p.getCurrency().getCurrencyCode(), p.getAddress(), p.getAddressTag(), p.getAmount());
}
return withdraw.getId();
} catch (BinanceException e) {
throw BinanceErrorAdapter.adapt(e);
}
}
use of org.knowm.xchange.service.trade.params.DefaultWithdrawFundsParams in project XChange by knowm.
the class BTCMarketsAccountService method withdrawFunds.
@Override
public String withdrawFunds(WithdrawFundsParams params) throws IOException {
if (params instanceof DefaultWithdrawFundsParams) {
DefaultWithdrawFundsParams defaultWithdrawFundsParams = (DefaultWithdrawFundsParams) params;
String address = defaultWithdrawFundsParams.address;
if (params instanceof RippleWithdrawFundsParams) {
address = address + "?dt=" + ((RippleWithdrawFundsParams) params).tag;
}
return withdrawCrypto(address, defaultWithdrawFundsParams.getAmount(), defaultWithdrawFundsParams.getCurrency());
}
throw new IllegalStateException("Cannot process " + params);
}
use of org.knowm.xchange.service.trade.params.DefaultWithdrawFundsParams in project XChange by knowm.
the class ExmoAccountService method withdrawFunds.
@Override
public String withdrawFunds(WithdrawFundsParams params) throws IOException {
Map<String, Object> result;
if (params instanceof RippleWithdrawFundsParams) {
RippleWithdrawFundsParams rippleWithdrawFundsParams = (RippleWithdrawFundsParams) params;
result = exmo.withdrawCrypt(signatureCreator, apiKey, exchange.getNonceFactory(), rippleWithdrawFundsParams.getAmount(), rippleWithdrawFundsParams.getCurrency().getCurrencyCode(), rippleWithdrawFundsParams.getAddress(), rippleWithdrawFundsParams.getTag());
} else if (params instanceof DefaultWithdrawFundsParams) {
DefaultWithdrawFundsParams defaultWithdrawFundsParams = (DefaultWithdrawFundsParams) params;
result = exmo.withdrawCrypt(signatureCreator, apiKey, exchange.getNonceFactory(), defaultWithdrawFundsParams.getAmount(), defaultWithdrawFundsParams.getCurrency().getCurrencyCode(), defaultWithdrawFundsParams.getAddress(), null);
} else {
throw new IllegalStateException("Don't understand " + params);
}
Boolean success = (Boolean) result.get("result");
if (success) {
return result.get("task_id").toString();
} else {
throw new ExchangeException("Withdrawal failed: " + result.get("error").toString());
}
}
Aggregations