Search in sources :

Example 1 with BitbayBalance

use of org.knowm.xchange.bitbay.dto.acount.BitbayBalance 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());
}
Also used : Currency(org.knowm.xchange.currency.Currency) ArrayList(java.util.ArrayList) Balance(org.knowm.xchange.dto.account.Balance) BitbayBalance(org.knowm.xchange.bitbay.dto.acount.BitbayBalance) Map(java.util.Map) AccountInfo(org.knowm.xchange.dto.account.AccountInfo) BitbayBalance(org.knowm.xchange.bitbay.dto.acount.BitbayBalance)

Aggregations

ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 BitbayBalance (org.knowm.xchange.bitbay.dto.acount.BitbayBalance)1 Currency (org.knowm.xchange.currency.Currency)1 AccountInfo (org.knowm.xchange.dto.account.AccountInfo)1 Balance (org.knowm.xchange.dto.account.Balance)1