I find it helpful to view every kind of account in terms of its current value and APY rate. I know it doesn't technically make sense for an investment account that holds unpredictable stocks and thus the "APY" would be unstable. But I would still find it helpful to have a number that indicates how well the totality of my stock holdings and cash have been doing in relation to simpler accounts.
I can calculate a simple interest as long as the principal is obvious. e.g. I invest 10k into a new account January 1st. After dividends and reinvestments and trades I end up with a total account value of 12k on December 31st. The APY rate is then r=(1/t)(A/P-1)=(1/1)(12/10-1)=0.2=20%
.
But I'm not sure what to do when more principal amounts are added to the account at different dates. In the above example, if I added $500 of principal in March, how do I get an answer that still makes sense? What additional information if any do I need to make the calculation?
In reality I am creating a script to help calculate, so it is fine if the equation needs to sum a lot of historical data. I could potentially find all these variables:
- List of dates and amounts of principal added to the account
- The current total value of the account
- List every transaction with date, the status of all cash and stock holdings at any given time
- Potentially the total account value at any given time if I look up historical quotes