Class Balance

    • Constructor Detail

      • Balance

        public Balance​(Currency currency,
                       BigDecimal total)
        Constructs a balance, the available will be the same as the total, and the frozen is zero. The borrowed and loaned will be zero.
        Parameters:
        currency - The underlying currency
        total - The total
      • Balance

        public Balance​(Currency currency,
                       BigDecimal total,
                       BigDecimal available)
        Constructs a balance, the frozen will be assigned as total - available. The borrowed and loaned will be zero.
        Parameters:
        currency - the underlying currency of this balance.
        total - the total amount of the currency in this balance.
        available - the amount of the currency in this balance that is available to trade.
      • Balance

        public Balance​(Currency currency,
                       BigDecimal total,
                       BigDecimal available,
                       BigDecimal frozen)
        Constructs a balance. The borrowed and loaned will be zero.
        Parameters:
        currency - the underlying currency of this balance.
        total - the total amount of the currency in this balance, including the available and frozen.
        available - the amount of the currency in this balance that is available to trade.
        frozen - the frozen amount of the currency in this balance that is locked in trading.
      • Balance

        public Balance​(Currency currency,
                       BigDecimal total,
                       BigDecimal available,
                       BigDecimal frozen,
                       BigDecimal borrowed,
                       BigDecimal loaned,
                       BigDecimal withdrawing,
                       BigDecimal depositing,
                       Date timestamp)
        Constructs a balance.
        Parameters:
        currency - the underlying currency of this balance.
        total - the total amount of the currency in this balance, equal to available + frozen - borrowed + loaned.
        available - the amount of the currency in this balance that is available to trade, including the borrowed.
        frozen - the frozen amount of the currency in this balance that is locked in trading.
        borrowed - the borrowed amount of the available currency in this balance that must be repaid.
        loaned - the loaned amount of the total currency in this balance that will be returned.
        withdrawing - the amount of the currency in this balance that is scheduled for withdrawal.
        depositing - the amount of the currency in this balance that is being deposited but not available yet.
        timestamp - Time the balance was valid on the exchange server
      • Balance

        public Balance​(Currency currency,
                       BigDecimal total,
                       BigDecimal available,
                       BigDecimal frozen,
                       BigDecimal borrowed,
                       BigDecimal loaned,
                       BigDecimal withdrawing,
                       BigDecimal depositing)
        Constructs a balance.
        Parameters:
        currency - the underlying currency of this balance.
        total - the total amount of the currency in this balance, equal to available + frozen - borrowed + loaned.
        available - the amount of the currency in this balance that is available to trade, including the borrowed.
        frozen - the frozen amount of the currency in this balance that is locked in trading.
        borrowed - the borrowed amount of the available currency in this balance that must be repaid.
        loaned - the loaned amount of the total currency in this balance that will be returned.
        withdrawing - the amount of the currency in this balance that is scheduled for withdrawal.
        depositing - the amount of the currency in this balance that is being deposited but not available yet.
    • Method Detail

      • zero

        public static Balance zero​(Currency currency)
        Returns a zero balance.
        Parameters:
        currency - the balance currency.
        Returns:
        a zero balance.
      • getCurrency

        public Currency getCurrency()
      • getTotal

        public BigDecimal getTotal()
        Returns the total amount of the currency in this balance.
        Returns:
        the total amount.
      • getAvailable

        public BigDecimal getAvailable()
        Returns the amount of the currency in this balance that is available to trade.
        Returns:
        the amount that is available to trade.
      • getAvailableForWithdrawal

        public BigDecimal getAvailableForWithdrawal()
        Returns the amount of the currency in this balance that may be withdrawn. Equal to available - borrowed.
        Returns:
        the amount that is available to withdraw.
      • getFrozen

        public BigDecimal getFrozen()
        Returns the frozen amount of the currency in this balance that is locked in trading.
        Returns:
        the amount that is locked in open orders.
      • getBorrowed

        public BigDecimal getBorrowed()
        Returns the borrowed amount of the available currency in this balance that must be repaid.
        Returns:
        the amount that must be repaid.
      • getLoaned

        public BigDecimal getLoaned()
        Returns the loaned amount of the total currency in this balance that will be returned.
        Returns:
        that amount that is loaned out.
      • getWithdrawing

        public BigDecimal getWithdrawing()
        Returns the amount of the currency in this balance that is locked in withdrawal
        Returns:
        the amount in withdrawal.
      • getDepositing

        public BigDecimal getDepositing()
        Returns the amount of the currency in this balance that is locked in deposit
        Returns:
        the amount in deposit.
      • getTimestamp

        public Date getTimestamp()
        Returns the time the balance was valid on the exchange server
        Returns:
        the timestamp.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object