Class ROICashFlowEntry
java.lang.Object
com.infinitekind.moneydance.model.ROICashFlowEntry
- All Implemented Interfaces:
java.lang.Comparable<ROICashFlowEntry>
public class ROICashFlowEntry extends java.lang.Object implements java.lang.Comparable<ROICashFlowEntry>
Tracks a transaction for Return On Investment/Internal Rate of Return computations. This class
tracks the date of the cash flow entry (which should be like a deposit or withdrawal for a bank:
do not include investment income entries) and the amount, as well as the number of days between
the transaction and the end of the reporting period.
This class is immutable.
-
Constructor Summary
Constructors Constructor Description ROICashFlowEntry(int dateInt, long value, CurrencyType investCurr, int startDateInt)
Constructor to allow all fields to be final.ROICashFlowEntry(SplitTxn splitTxn, InvestTxnType txnType, CurrencyType investCurr, int startDateInt)
Constructor from a security transaction. -
Method Summary
Modifier and Type Method Description double
annumsInPeriod()
int
compareTo(ROICashFlowEntry other)
static long
getCashFlowAmount(SplitTxn splitTxn, InvestTxnType txnType, CurrencyType investCurr)
Determine the amount of a transaction that is appropriate for a cash flow series for an ROI computation.int
getDateInt()
double
getValue()
void
setStartDate(int startDateInt)
Define the start date and thus compute/recompute the number of years to the end.
-
Constructor Details
-
ROICashFlowEntry
public ROICashFlowEntry(SplitTxn splitTxn, InvestTxnType txnType, CurrencyType investCurr, int startDateInt)Constructor from a security transaction.- Parameters:
splitTxn
- The transaction to be analyzed.txnType
- The type of transactioninvestCurr
- Currency to use (dollars, euro, etc., not shares).startDateInt
- The start of the reporting period.
-
ROICashFlowEntry
Constructor to allow all fields to be final. This can be either a transaction or a total amount (account balance).- Parameters:
dateInt
- The entry's date.value
- The entry's value as a long, already expressed in terms of the destination currency (investCurr
).investCurr
- Currency to use (dollars, euro, etc., not shares).startDateInt
- The start of the reporting period.
-
-
Method Details
-
setStartDate
public final void setStartDate(int startDateInt)Define the start date and thus compute/recompute the number of years to the end. This method is called by the constructor and thus is marked 'final'.- Parameters:
startDateInt
- The new period start date to specify.
-
getCashFlowAmount
public static long getCashFlowAmount(SplitTxn splitTxn, InvestTxnType txnType, CurrencyType investCurr)Determine the amount of a transaction that is appropriate for a cash flow series for an ROI computation. Deposits = initial balance, buys, misc exp = positive numbers. These are inflows into the security and outflows of cash. Withdrawals = ending balance, sells, dividends, misc inc = negative values. These are outflows from the security and inflows of cash.- Parameters:
splitTxn
- The transaction to use.txnType
- The type of investment transaction.investCurr
- The currency of the investment account cash portion (dollars).- Returns:
- The cash amount of the transaction to use for ROI computations, etc.
-
getValue
public double getValue()- Returns:
- The amount expressed in terms of the destination currency (dollar, euro, etc.).
-
annumsInPeriod
public double annumsInPeriod()- Returns:
- The number of days from the transaction to the end of the period, divided by 365.
-
getDateInt
public int getDateInt()- Returns:
- Get the date of the entry.
-
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<ROICashFlowEntry>
-