I noticed that the current way of calculating portfolio growth is incorrect and can lead to misrepresentation of facts and cause your customers to report taxes incorrectly.
Here’s an example of what I mean:
- I purchased 1 TSLA @446.5 a few weeks ago
- I purchased 1 TSLA @497.87 today
- I sold 1 TSLA @498 later today
How Trading212 calculates my TSLA portfolio:
- On first purchase, shows me “Price” as 446.5 and “Result” as difference between market value and this “Price”
- On next purchase, uses average of two amounts 446.5 and 497.87 to show me “Price” as 472.18 and “Result” as the difference between market value and this averaged “Price”
- On partial sale, it doesn’t recalculate “Price” or “Result”, and this is where my problem is.
Assume if TSLA falls to a value less than this incorrect averaged “Price” of 472.18, like 460, then it will render “Result” as GBP equivalent of -12.18 USD, indicating that my portfolio is going in a loss, where as actually I would be running a profit of 13.63 USD (that is 460 - (446.5 + 497.87 - 498)) minus negligible conversion charges.
The correct way to calculate “Price” should be as follows:
- Sum all purchase amounts of a given share till date (446.5 + 497.87 = 994.37)
- Subtract sum of all sales of this share till date from the above amount (994.37 - 498 = 446.37)
- Divide the resulting amount by number of shares currently held (446.37 / (1 + 1 - 1) = 446.37)
Then the “Result” can simply be rendered by computing “(Market Value - GBP equivalent of Price) * number of shares held” and it will reflect accurate portfolio growth.
I do understand that your current implementation lists “Profit” on sale of each share as the difference between market price and previously calculated averaged price, but that profit entry is only visible in “History” section of Android app, and the “Portfolio” section wrongly suggests “Return” value because of the missing sale information, which cannot even be checked on Desktop at all.
Looking forward to a resolution soon,