# Calculating returns from transactions

I have a collection of client transactions representing the trades of a single portfolio across multiple securities. What I'd like to do is the calculate the accurate ROI of each security and of the whole portfolio (total and by year).

Sounds simple but it's not in a number of dimensions:

1. I only have all the transactions between date a and date b, so there may be some starting position that I can only guess based on the transaction I have.
2. As there may be splits, reverse splits, and other changes of capital I can't just add the volumes from transactions because they may not be on the same scale (e.g. one is before and one is after a split).
3. To avoid caring about dividends and bonuses I'd like to use the adjusted closing prices but that creates a couple of problems - because the adjusted closing already accounts for capital changes so I can't just multiply adjusted volume by adjusted price.

Any ideas? is there a simple standard way of solving this?

Thanks, D

• On Jan-1, my portfolio has 1000 shares of AAPL. I bought 200 shares of SPY on January 15 and sold 100 shares on January 16 for a profit of \$1 per share. Then I compiled a list of trades between Jan-10 and Jan-20. What would be the portfolio return in this example? – Sergei Rodionov Feb 5 at 16:27
• In general this calculation requires an (expensive) piece of trade accounting software that mutual funds and hedge fund use and takes care of all the subtleties you indicate. In addition, you seem to be missing some key information (e.g. the initial stock positions and the initial cash position, also the value of all the stocks you own and do not sell on the day you sell/buy a stock). – noob2 Feb 5 at 17:23
• @Sergei Rodionov: The return between the 10th and 20th would be: whatever 1000 AAPL + 100 SPY were worth on the 20th of Jan - whatever 1000 AAPL were worth on the 10th - (cost of buying 200 SPY - selling 100 SPY) / (whatever 1000 AAPL were worth on the 10th + cost of buying 200 SPY). – user1467422 Feb 6 at 8:55
• @noob2 the value of the stocks can be calculated from the positions and public market data. You're right that I don't have the positions and can only guess them from the transactions. – user1467422 Feb 6 at 8:58
• @user1467422 - In the question you say that only trades are available but in the example exact positions, even non-traded, are used to calculate the total return. Do you need to calculate realized or mark-to-market return? – Sergei Rodionov Feb 6 at 10:43