use of org.knowm.xchange.dto.account.AccountInfo in project XChange by knowm.
the class CoinfloorBalanceIntegration method fetchBalanceTest.
@Test
public void fetchBalanceTest() throws IOException {
final ExchangeSpecification specification = new ExchangeSpecification(CoinfloorExchange.class);
String username = System.getProperty("xchange.coinfloor.username");
String password = System.getProperty("xchange.coinfloor.password");
if (username == null || password == null) {
return;
}
specification.setUserName(username);
specification.setPassword(password);
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(specification);
AccountService service = exchange.getAccountService();
AccountInfo info = service.getAccountInfo();
logger.info("{}", info);
}
use of org.knowm.xchange.dto.account.AccountInfo in project XChange by knowm.
the class LatokenAccountService method getAccountInfo.
@Override
public AccountInfo getAccountInfo() throws IOException {
try {
List<LatokenBalance> latokenBalances = getLatokenBalances();
List<Balance> balances = latokenBalances.stream().map(latokenBalance -> LatokenAdapters.adaptBalance(latokenBalance)).collect(Collectors.toList());
Wallet wallet = Wallet.Builder.from(balances).build();
return new AccountInfo(null, TRADING_FEE, Arrays.asList(wallet), new Date());
} catch (LatokenException e) {
throw LatokenErrorAdapter.adapt(e);
}
}
use of org.knowm.xchange.dto.account.AccountInfo in project XChange by knowm.
the class BitbayAdapters method adaptAccountInfo.
public static AccountInfo adaptAccountInfo(String userName, BitbayAccountInfoResponse bitbayAccountInfo) {
List<Balance> balances = new ArrayList<>(bitbayAccountInfo.getBitbayBalances().size());
for (Map.Entry<String, BitbayBalance> entry : bitbayAccountInfo.getBitbayBalances().entrySet()) {
Currency currency = Currency.getInstance(entry.getKey());
BitbayBalance balance = entry.getValue();
balances.add(new Balance(currency, balance.getAvailable().add(balance.getLocked()), balance.getAvailable(), balance.getLocked()));
}
return new AccountInfo(userName, Wallet.Builder.from(balances).build());
}
use of org.knowm.xchange.dto.account.AccountInfo in project XChange by knowm.
the class BitbayAccountService method getAccountInfo.
@Override
public AccountInfo getAccountInfo() throws IOException {
List<Wallet> wallets = new ArrayList<>();
for (BitbayBalances.BitbayBalance balance : balances()) {
Wallet wallet = Wallet.Builder.from(Arrays.asList(new Balance(Currency.getInstance(balance.getCurrency()), balance.getTotalFunds(), balance.getAvailableFunds(), balance.getLockedFunds()))).id(balance.getId()).build();
wallets.add(wallet);
}
return new AccountInfo(wallets);
}
use of org.knowm.xchange.dto.account.AccountInfo in project XChange by knowm.
the class AccountDataFetchIntegration method testBalance.
@Test
public void testBalance() throws IOException, InterruptedException {
if (!BTCTurkDemoUtilsTest.BTCTURK_APIKEY.isEmpty()) {
// BTCTurkAccountBalance Test
BTCTurkAccountBalance accountBalance = btcTurkAccountService.getBTCTurkBalance();
assertThat(accountBalance).isNotEqualTo(null);
assertThat(accountBalance.getBtctry_maker_fee_percentage()).isEqualTo(new BigDecimal("0.0012711860000000"));
// AccountInfo Test
Thread.sleep(1000);
AccountInfo accountInfo = btcTurkAccountService.getAccountInfo();
assertThat(accountInfo).isNotEqualTo(null);
} else
assertThat(accountService).isNotEqualTo(null);
}
Aggregations