Search in sources :

Example 1 with LatokenBalance

use of org.knowm.xchange.latoken.dto.account.LatokenBalance 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);
    }
}
Also used : AccountInfo(org.knowm.xchange.dto.account.AccountInfo) Arrays(java.util.Arrays) AccountService(org.knowm.xchange.service.account.AccountService) LatokenException(org.knowm.xchange.latoken.dto.LatokenException) Wallet(org.knowm.xchange.dto.account.Wallet) Date(java.util.Date) LatokenBalance(org.knowm.xchange.latoken.dto.account.LatokenBalance) IOException(java.io.IOException) Exchange(org.knowm.xchange.Exchange) Collectors(java.util.stream.Collectors) Balance(org.knowm.xchange.dto.account.Balance) BigDecimal(java.math.BigDecimal) List(java.util.List) LatokenErrorAdapter(org.knowm.xchange.latoken.LatokenErrorAdapter) LatokenAdapters(org.knowm.xchange.latoken.LatokenAdapters) LatokenException(org.knowm.xchange.latoken.dto.LatokenException) LatokenBalance(org.knowm.xchange.latoken.dto.account.LatokenBalance) Wallet(org.knowm.xchange.dto.account.Wallet) LatokenBalance(org.knowm.xchange.latoken.dto.account.LatokenBalance) Balance(org.knowm.xchange.dto.account.Balance) AccountInfo(org.knowm.xchange.dto.account.AccountInfo) Date(java.util.Date)

Aggregations

IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 Arrays (java.util.Arrays)1 Date (java.util.Date)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Exchange (org.knowm.xchange.Exchange)1 AccountInfo (org.knowm.xchange.dto.account.AccountInfo)1 Balance (org.knowm.xchange.dto.account.Balance)1 Wallet (org.knowm.xchange.dto.account.Wallet)1 LatokenAdapters (org.knowm.xchange.latoken.LatokenAdapters)1 LatokenErrorAdapter (org.knowm.xchange.latoken.LatokenErrorAdapter)1 LatokenException (org.knowm.xchange.latoken.dto.LatokenException)1 LatokenBalance (org.knowm.xchange.latoken.dto.account.LatokenBalance)1 AccountService (org.knowm.xchange.service.account.AccountService)1