com.xeiam.xchange.examples.mercadobitcoin.account.MercadoBitcoinAccountDemo 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.mercadobitcoin.account;
import java.io.IOException;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.dto.account.AccountInfo;
import com.xeiam.xchange.examples.mercadobitcoin.InteractiveAuthenticatedExchange;
import com.xeiam.xchange.mercadobitcoin.dto.MercadoBitcoinBaseTradeApiResult;
import com.xeiam.xchange.mercadobitcoin.dto.account.MercadoBitcoinAccountInfo;
import com.xeiam.xchange.mercadobitcoin.service.polling.MercadoBitcoinAccountServiceRaw;
import com.xeiam.xchange.service.polling.account.PollingAccountService;
/**
*
* Example showing the following:
*
*
* - Connect to Mercado Bitcoin exchange with authentication
* - View account balance
* - Get the bitcoin deposit address
* - Withdraw a small amount of BTC
*
*
* @author Copied from Bitstamp and adapted by Felipe Micaroni Lalli
*/
public class MercadoBitcoinAccountDemo {
public static void main(String[] args) throws IOException {
Exchange mercadoBitcoin = InteractiveAuthenticatedExchange.createInstanceFromDefaultInput();
PollingAccountService accountService = mercadoBitcoin.getPollingAccountService();
generic(accountService);
raw((MercadoBitcoinAccountServiceRaw) 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());
}
private static void raw(MercadoBitcoinAccountServiceRaw accountService) throws IOException {
// Get the account information
MercadoBitcoinBaseTradeApiResult mercadoBitcoinAccountInfo = accountService.getMercadoBitcoinAccountInfo();
System.out.println("MercadoBitcoinBaseTradeApiResult as String: " + mercadoBitcoinAccountInfo.toString());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy