StocksMonitor 1.5.0

hirondelle.stocks.quotes
Class Quote

Object
  extended by Quote

public final class Quote
extends Object

Data-centric, immutable value class which represents the dynamic price data attached to a Stock.


Constructor Summary
Quote(Stock aStock, BigDecimal aCurrentPrice, BigDecimal aChange)
          Constructor.
 
Method Summary
 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.
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Quote

public Quote(Stock aStock,
             BigDecimal aCurrentPrice,
             BigDecimal aChange)
Constructor.

Parameters:
aStock - satisfies aStock!=null
aCurrentPrice - current price of aStock,and satisfies aPrice!=null && aPrice>=0
aChange - current price less the opening price of aStock, and satisfies aChange!=null
Method Detail

getPercentChange

public BigDecimal getPercentChange()
Return the percentage change between the opening price and the current price; if getPrice() returns 0, then this method returns 0.

Example: current price=1.00 and change=0.20, returns a value of 25.00.


getCurrentValue

public BigDecimal getCurrentValue()
Return the product of Stock.getNumShares() and getPrice(). Represents the current value of the holding, using the latest available price quote.


getProfit

public BigDecimal getProfit()
Return getCurrentValue() less Stock.getBookValue().


getPercentProfit

public BigDecimal getPercentProfit()
Return getProfit() divided by Stock.getBookValue(), multiplied by 100; if Stock.getBookValue() or getPrice() returns 0, then this method returns 0.


getStock

public Stock getStock()
Return the aStock passed to the constructor.


getPrice

public BigDecimal getPrice()
Return the aPrice passed to the constructor.


getChange

public BigDecimal getChange()
Return the aChange passed to the constructor.


toString

public String toString()
Represent this object as a String - intended for logging purposes only.

Overrides:
toString in class Object

equals

public boolean equals(Object aThat)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

StocksMonitor 1.5.0

Copyright Hirondelle Systems - License - Generated 2008Jul12.10.53