Venice 0.7beta

org.mov.portfolio
Class StockHolding

java.lang.Object
  extended by org.mov.portfolio.StockHolding

public class StockHolding
extends java.lang.Object

Representation of a single stock holding in a share account.

Author:
Andrew Leppard
See Also:
ShareAccount

Constructor Summary
StockHolding(Symbol symbol, int shares, double cost, TradingDate date)
          Create a new stock holding
 
Method Summary
 void accumulate(int shares, double cost)
          Increase ownership of stock.
 boolean equals(java.lang.Object object)
          Compares this stock holding to another.
 double getCost()
          Get average cost per share
 TradingDate getDate()
          Get the initial date that at least part of these shares was purchased on.
 int getShares()
          Get number of shares held.
 Symbol getSymbol()
          Get symbol of stock held.
 void reduce(int shares)
          Decrease ownership of stock.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StockHolding

public StockHolding(Symbol symbol,
                    int shares,
                    double cost,
                    TradingDate date)
Create a new stock holding

Parameters:
symbol - the stock to own
shares - the number of shares of that stock
cost - average cost per share
date - the date the shares were purchased
Method Detail

accumulate

public void accumulate(int shares,
                       double cost)
Increase ownership of stock.

Parameters:
shares - number of new shares to accumulate
cost - average cost of shares

reduce

public void reduce(int shares)
Decrease ownership of stock.

Parameters:
shares - number of shares to reduce

getSymbol

public Symbol getSymbol()
Get symbol of stock held.

Returns:
symbol

getShares

public int getShares()
Get number of shares held.

Returns:
number of shares

getCost

public double getCost()
Get average cost per share

Returns:
average cost per share

getDate

public TradingDate getDate()
Get the initial date that at least part of these shares was purchased on.

Returns:
date

equals

public boolean equals(java.lang.Object object)
Compares this stock holding to another.

Overrides:
equals in class java.lang.Object
Parameters:
object - another stock holding
Returns:
true if the stock holdings are equal; false otherwise

Venice 0.7beta