com.xeiam.xchange.examples.taurus.account.TaurusAccountDemo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-examples Show documentation
Show all versions of xchange-examples Show documentation
Provides a set of examples that demonstrate how to use XChange in client applications
The newest version!
package com.xeiam.xchange.examples.taurus.account;
import java.io.IOException;
import java.math.BigDecimal;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.currency.Currencies;
import com.xeiam.xchange.dto.account.AccountInfo;
import com.xeiam.xchange.examples.taurus.TaurusDemoUtils;
import com.xeiam.xchange.service.polling.account.PollingAccountService;
import com.xeiam.xchange.taurus.dto.account.TaurusBalance;
import com.xeiam.xchange.taurus.service.polling.TaurusAccountServiceRaw;
/**
*
* Example showing the following:
*
*
* - Connect to Taurus exchange with authentication
* - View account balance
* - Get the bitcoin deposit address
* - List unconfirmed deposits (raw interface only)
* - List recent withdrawals (raw interface only)
* - Withdraw a small amount of BTC
*
*/
public class TaurusAccountDemo {
public static void main(String[] args) throws IOException {
Exchange taurus = TaurusDemoUtils.createExchange();
PollingAccountService accountService = taurus.getPollingAccountService();
generic(accountService);
raw((TaurusAccountServiceRaw) accountService);
}
private static void generic(PollingAccountService accountService) throws IOException {
// Get the account information
AccountInfo accountInfo = accountService.getAccountInfo();
System.out.println("AccountInfo as String: " + accountInfo.toString());
String depositAddress = accountService.requestDepositAddress(Currencies.BTC);
System.out.println("Deposit address: " + depositAddress);
String withdrawResult = accountService.withdrawFunds("BTC", new BigDecimal(1).movePointLeft(4), "1MqzGxp6fPdkCyEHe3hZK7rgnSSzHABh7f");
System.out.println("withdrawResult = " + withdrawResult);
}
private static void raw(TaurusAccountServiceRaw accountService) throws IOException {
// Get the account information
TaurusBalance taurusBalance = accountService.getTaurusBalance();
System.out.println("TaurusBalance: " + taurusBalance);
String depositAddress = accountService.getTaurusBitcoinDepositAddress();
System.out.println("TaurusDepositAddress address: " + depositAddress);
String withdrawResult = accountService.withdrawTaurusFunds(new BigDecimal(1).movePointLeft(4), "1MqzGxp6fPdkCyEHe3hZK7rgnSSzHABh7f");
System.out.println("TaurusBooleanResponse = " + withdrawResult);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy