All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.knowm.xchange.examples.bittrex.account.BittrexAccountDemo Maven / Gradle / Ivy

Go to download

Provides a set of examples that demonstrate how to use XChange in client applications

The newest version!
package org.knowm.xchange.examples.bittrex.account;

import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.bittrex.dto.account.BittrexAddress;
import org.knowm.xchange.bittrex.dto.account.BittrexBalance;
import org.knowm.xchange.bittrex.service.BittrexAccountServiceRaw;
import org.knowm.xchange.currency.Currency;
import org.knowm.xchange.dto.account.Balance;
import org.knowm.xchange.examples.bittrex.BittrexExamplesUtils;
import org.knowm.xchange.service.account.AccountService;

public class BittrexAccountDemo {

  public static void main(String[] args) throws IOException {

    Exchange exchange = BittrexExamplesUtils.getExchange();

    AccountService accountService = exchange.getAccountService();

    generic(accountService);
    raw((BittrexAccountServiceRaw) accountService);
  }

  private static void generic(AccountService accountService) throws IOException {

    System.out.println("----------GENERIC---------");

    Map balances = accountService.getAccountInfo().getWallet().getBalances();
    System.out.println(balances);

    System.out.println(accountService.requestDepositAddress(Currency.BTC));
  }

  private static void raw(BittrexAccountServiceRaw accountService) throws IOException {

    System.out.println("------------RAW-----------");

    Collection balances = accountService.getBittrexBalances();
    System.out.println(balances);

    List depositAddress = accountService.getBittrexDepositAddresses("BTC");
    System.out.println(depositAddress);

    BittrexBalance balance = accountService.getBittrexBalance(Currency.getInstance("BCC"));
    System.out.println(balance);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy