Package org.knowm.xchange.dto.account
Class Balance
java.lang.Object
org.knowm.xchange.dto.account.Balance
- All Implemented Interfaces:
Serializable
,Comparable<Balance>
DTO representing a balance in a currency
This is simply defined by an amount of money in a given currency, contained in the cash object.
This class is immutable.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionBalance
(Currency currency, BigDecimal total) Constructs a balance, theavailable
will be the same as thetotal
, and thefrozen
is zero.Balance
(Currency currency, BigDecimal total, BigDecimal available) Constructs a balance, thefrozen
will be assigned astotal
-available
.Balance
(Currency currency, BigDecimal total, BigDecimal available, BigDecimal frozen) Constructs a balance.Balance
(Currency currency, BigDecimal total, BigDecimal available, BigDecimal frozen, BigDecimal borrowed, BigDecimal loaned, BigDecimal withdrawing, BigDecimal depositing) Constructs a balance.Balance
(Currency currency, BigDecimal total, BigDecimal available, BigDecimal frozen, BigDecimal borrowed, BigDecimal loaned, BigDecimal withdrawing, BigDecimal depositing, Date timestamp) Constructs a balance. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
Returns the amount of thecurrency
in this balance that is available to trade.Returns the amount of thecurrency
in this balance that may be withdrawn.Returns the borrowed amount of the availablecurrency
in this balance that must be repaid.Returns the amount of thecurrency
in this balance that is locked in depositReturns the frozen amount of thecurrency
in this balance that is locked in trading.Returns the loaned amount of the totalcurrency
in this balance that will be returned.Returns the time the balance was valid on the exchange servergetTotal()
Returns the total amount of thecurrency
in this balance.Returns the amount of thecurrency
in this balance that is locked in withdrawalint
hashCode()
toString()
static Balance
Returns a zero balance.
-
Constructor Details
-
Balance
Constructs a balance, theavailable
will be the same as thetotal
, and thefrozen
is zero. Theborrowed
andloaned
will be zero.- Parameters:
currency
- The underlying currencytotal
- The total
-
Balance
Constructs a balance, thefrozen
will be assigned astotal
-available
. Theborrowed
andloaned
will be zero.- Parameters:
currency
- the underlying currency of this balance.total
- the total amount of thecurrency
in this balance.available
- the amount of thecurrency
in this balance that is available to trade.
-
Balance
Constructs a balance. Theborrowed
andloaned
will be zero.- Parameters:
currency
- the underlying currency of this balance.total
- the total amount of thecurrency
in this balance, including theavailable
andfrozen
.available
- the amount of thecurrency
in this balance that is available to trade.frozen
- the frozen amount of thecurrency
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 thecurrency
in this balance, equal toavailable + frozen - borrowed + loaned
.available
- the amount of thecurrency
in this balance that is available to trade, including theborrowed
.frozen
- the frozen amount of thecurrency
in this balance that is locked in trading.borrowed
- the borrowed amount of the availablecurrency
in this balance that must be repaid.loaned
- the loaned amount of the totalcurrency
in this balance that will be returned.withdrawing
- the amount of thecurrency
in this balance that is scheduled for withdrawal.depositing
- the amount of thecurrency
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 thecurrency
in this balance, equal toavailable + frozen - borrowed + loaned
.available
- the amount of thecurrency
in this balance that is available to trade, including theborrowed
.frozen
- the frozen amount of thecurrency
in this balance that is locked in trading.borrowed
- the borrowed amount of the availablecurrency
in this balance that must be repaid.loaned
- the loaned amount of the totalcurrency
in this balance that will be returned.withdrawing
- the amount of thecurrency
in this balance that is scheduled for withdrawal.depositing
- the amount of thecurrency
in this balance that is being deposited but not available yet.
-
-
Method Details
-
zero
Returns a zero balance.- Parameters:
currency
- the balance currency.- Returns:
- a zero balance.
-
getCurrency
-
getTotal
Returns the total amount of thecurrency
in this balance.- Returns:
- the total amount.
-
getAvailable
Returns the amount of thecurrency
in this balance that is available to trade.- Returns:
- the amount that is available to trade.
-
getAvailableForWithdrawal
Returns the amount of thecurrency
in this balance that may be withdrawn. Equal toavailable - borrowed
.- Returns:
- the amount that is available to withdraw.
-
getFrozen
Returns the frozen amount of thecurrency
in this balance that is locked in trading.- Returns:
- the amount that is locked in open orders.
-
getBorrowed
Returns the borrowed amount of the availablecurrency
in this balance that must be repaid.- Returns:
- the amount that must be repaid.
-
getLoaned
Returns the loaned amount of the totalcurrency
in this balance that will be returned.- Returns:
- that amount that is loaned out.
-
getWithdrawing
Returns the amount of thecurrency
in this balance that is locked in withdrawal- Returns:
- the amount in withdrawal.
-
getDepositing
Returns the amount of thecurrency
in this balance that is locked in deposit- Returns:
- the amount in deposit.
-
getTimestamp
Returns the time the balance was valid on the exchange server- Returns:
- the timestamp.
-
toString
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Balance>
-