Class Wallet

  • All Implemented Interfaces:
    Serializable

    public final class Wallet
    extends Object
    implements Serializable
    DTO representing a wallet

    A wallet has a set of current balances in various currencies held on the exchange.

    See Also:
    Serialized Form
    • Constructor Detail

      • Wallet

        public Wallet​(String id,
                      String name,
                      Collection<Balance> balances,
                      Set<Wallet.WalletFeature> features,
                      BigDecimal maxLeverage,
                      BigDecimal currentLeverage)
        Constructs a Wallet.
        Parameters:
        id - the wallet id
        name - a descriptive name for the wallet
        balances - the balances, the currencies of the balances should not be duplicated.
        features - all the features that wallet supports

        maxLeverage and currentLeverage are BigDecimal.ZERO for the default constructor

    • Method Detail

      • getId

        public String getId()
        Returns:
        The wallet id
      • getName

        public String getName()
        Returns:
        A descriptive name for the wallet
      • getBalances

        public Map<Currency,​Balance> getBalances()
        Returns:
        The available balances (amount and currency)
      • getMaxLeverage

        public BigDecimal getMaxLeverage()
        Returns:
        Max leverage of wallet
      • getCurrentLeverage

        public BigDecimal getCurrentLeverage()
        Returns:
        current leverage of wallet
      • getBalance

        public Balance getBalance​(Currency currency)
        Returns the balance for the specified currency.
        Parameters:
        currency - a Currency.
        Returns:
        the balance of the specified currency, or a zero balance if currency not present
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object