Search in sources :

Example 1 with IndependentReserveAccount

use of org.knowm.xchange.independentreserve.dto.account.IndependentReserveAccount in project XChange by knowm.

the class IndependentReserveAdapters method adaptWallet.

public static Wallet adaptWallet(IndependentReserveBalance independentReserveBalance) {
    List<Balance> balances = new ArrayList<>();
    for (IndependentReserveAccount balanceAccount : independentReserveBalance.getIndependentReserveAccounts()) {
        Currency currency = Currency.getInstance(balanceAccount.getCurrencyCode().toUpperCase());
        balances.add(new Balance(currency.getCommonlyUsedCurrency(), balanceAccount.getTotalBalance(), balanceAccount.getAvailableBalance()));
    }
    return Wallet.Builder.from(balances).build();
}
Also used : IndependentReserveAccount(org.knowm.xchange.independentreserve.dto.account.IndependentReserveAccount) Currency(org.knowm.xchange.currency.Currency) ArrayList(java.util.ArrayList) Balance(org.knowm.xchange.dto.account.Balance) IndependentReserveBalance(org.knowm.xchange.independentreserve.dto.account.IndependentReserveBalance)

Aggregations

ArrayList (java.util.ArrayList)1 Currency (org.knowm.xchange.currency.Currency)1 Balance (org.knowm.xchange.dto.account.Balance)1 IndependentReserveAccount (org.knowm.xchange.independentreserve.dto.account.IndependentReserveAccount)1 IndependentReserveBalance (org.knowm.xchange.independentreserve.dto.account.IndependentReserveBalance)1