Constructor and Description |
---|
Quote(Stock aStock,
BigDecimal aCurrentPrice,
BigDecimal aChange)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object aThat) |
BigDecimal |
getChange()
Return the aChange passed to the constructor.
|
BigDecimal |
getCurrentValue()
Return the product of
Stock.getNumShares() and getPrice() . |
BigDecimal |
getPercentChange()
Return the percentage change between the opening price and the
current price; if
getPrice() returns 0, then this method returns 0. |
BigDecimal |
getPercentProfit()
Return
getProfit() divided by Stock.getBookValue() , multiplied
by 100; if Stock.getBookValue() or getPrice() returns 0,
then this method returns 0. |
BigDecimal |
getPrice()
Return the aPrice passed to the constructor.
|
BigDecimal |
getProfit()
Return
getCurrentValue() less Stock.getBookValue() . |
Stock |
getStock()
Return the aStock passed to the constructor.
|
int |
hashCode() |
String |
toString()
Represent this object as a String - intended for logging purposes only.
|
public Quote(Stock aStock, BigDecimal aCurrentPrice, BigDecimal aChange)
aStock
- satisfies aStock!=nullaCurrentPrice
- current price of aStock,and
satisfies aPrice!=null && aPrice>=0aChange
- current price less the opening price of aStock,
and satisfies aChange!=nullpublic BigDecimal getPercentChange()
getPrice()
returns 0, then this method returns 0.
Example: current price=1.00 and change=0.20, returns a value of 25.00.
public BigDecimal getCurrentValue()
Stock.getNumShares()
and getPrice()
.
Represents the current value of the holding, using the latest available
price quote.public BigDecimal getProfit()
getCurrentValue()
less Stock.getBookValue()
.public BigDecimal getPercentProfit()
getProfit()
divided by Stock.getBookValue()
, multiplied
by 100; if Stock.getBookValue()
or getPrice()
returns 0,
then this method returns 0.public BigDecimal getPrice()
public BigDecimal getChange()
public String toString()
Copyright Hirondelle Systems - License - Generated 2013Sep20.10.58