|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mov.portfolio.Portfolio
public class Portfolio
Representation of a portfolio. A portfolio object contains several
accounts, accounts can be either CashAccount
or
ShareAccount
.
Constructor Summary | |
---|---|
Portfolio(java.lang.String name,
boolean isTransient)
Create a new empty portfolio using the default currency. |
|
Portfolio(java.lang.String name,
Currency currency)
Create a new empty portfolio using the given currency. |
|
Portfolio(java.lang.String name,
Currency currency,
boolean isTransient)
Create a new empty portfolio using the given currency. |
Method Summary | |
---|---|
void |
addAccount(Account account)
Add an account to the portfolio. |
void |
addTransaction(Transaction transaction)
Record a single transaction on the portfolio. |
void |
addTransactions(java.util.List transactions)
Record multiple transactions on the portfolio. |
java.lang.Object |
clone()
Create a clone of this portfolio. |
int |
countAccounts(int type)
Return the number of accounts of the given type the portfolio has |
int |
countTransactions()
Count the number of transactions. |
int |
countTransactions(int type)
Count the number of transactions of the given type. |
boolean |
equals(java.lang.Object object)
Compares this portfolio to another. |
Account |
findAccountByName(java.lang.String name)
Find and return the account with the given name in the portfolio. |
java.util.List |
getAccounts()
Return all the accounts in the portfolio |
Money |
getCashValue(TradingDate date)
Get the cash value of the Portfolio on the current day. |
Currency |
getCurrency()
Return the portfolio's default currency. |
TradingDate |
getLastDate()
Return the date of the last transaction in this portfolio. |
java.lang.String |
getName()
Return the portfolio name. |
Portfolio |
getPortfolio(TradingDate date)
Returns the state of the Portfolio on the given date. |
Money |
getReturnValue(EODQuoteBundle quoteBundle,
TradingDate date)
Get the return of the Portfolio on the current day. |
Money |
getShareValue(EODQuoteBundle quoteBundle,
TradingDate date)
Get the share value of the Portfolio on the current day. |
TradingDate |
getStartDate()
Return the start date of this portfolio. |
java.util.List |
getStocksHeld()
Return a list of all the stocks currently held in the portfolio. |
java.util.List |
getSymbolsTraded()
Returns all the symbols traded in this portfolio. |
java.util.List |
getTransactions()
Return the transaction history. |
Money |
getValue(EODQuoteBundle quoteBundle,
int dateOffset)
Get the value of the portfolio on the given day. |
Money |
getValue(EODQuoteBundle quoteBundle,
TradingDate date)
Get the value of the portfolio on the given day. |
boolean |
isTransient()
Return whether the portfolio is transient or permanent. |
java.util.Iterator |
iterator()
Return an iterator that iterates over every day from the date of the first transaction to whenever the user chooses to stop iterating. |
void |
removeAllTransactions()
Remove all transactions from portfolio. |
void |
setName(java.lang.String name)
Set the portfolio name. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Portfolio(java.lang.String name, Currency currency)
name
- The name of the portfoliocurrency
- The base currency of the portfoliopublic Portfolio(java.lang.String name, boolean isTransient)
name
- The name of the portfolioisTransient
- Set to true
if the portfolio displays
working information and shouldn't be saved.public Portfolio(java.lang.String name, Currency currency, boolean isTransient)
name
- The name of the portfoliocurrency
- The base currency of the portfolioisTransient
- Set to true
if the portfolio displays
working information and shouldn't be saved.Method Detail |
---|
public java.lang.String getName()
public void setName(java.lang.String name)
name
- the new portfolio name.public Currency getCurrency()
public boolean isTransient()
true
if the portfolio is transient and shouldn't
be savedpublic void addAccount(Account account)
account
- the new account to addpublic void addTransactions(java.util.List transactions)
transactions
- a list of transactionsTransaction
public void addTransaction(Transaction transaction)
transaction
- a new transactionpublic java.lang.Object clone()
clone
in class java.lang.Object
public java.util.List getAccounts()
public int countAccounts(int type)
type
- account type, e.g. Account.CASH_ACCOUNT
public Account findAccountByName(java.lang.String name)
name
- the name of the account to search for
null
if it could not be foundpublic TradingDate getStartDate()
public TradingDate getLastDate()
public java.util.List getSymbolsTraded()
public int countTransactions()
public int countTransactions(int type)
public java.util.List getTransactions()
Transaction
public void removeAllTransactions()
public Money getValue(EODQuoteBundle quoteBundle, TradingDate date) throws MissingQuoteException
quoteBundle
- the quote bundledate
- the date to calculate the value
MissingQuoteException
public Money getValue(EODQuoteBundle quoteBundle, int dateOffset) throws MissingQuoteException
quoteBundle
- the quote bundledateOffset
- fast date offset
MissingQuoteException
public java.util.List getStocksHeld()
public Money getCashValue(TradingDate date)
date
- the date.
public Money getShareValue(EODQuoteBundle quoteBundle, TradingDate date) throws MissingQuoteException
quoteBundle
- the quote bundledate
- the date
MissingQuoteException
public Money getReturnValue(EODQuoteBundle quoteBundle, TradingDate date) throws MissingQuoteException
quoteBundle
- the quote bundledate
- the date
MissingQuoteException
public java.util.Iterator iterator()
getPortfolio(TradingDate)
public Portfolio getPortfolio(TradingDate date)
iterator()
method is
more efficient.
date
- the date to query
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- another portfolio
true
if the portfolios are equal; false
otherwise
|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |