https://bugs.kde.org/show_bug.cgi?id=396301
--- Comment #4 from Jon <clouddrive...@gmail.com> --- To answer you question, the 3.5 shares not sold are the $350 in the Ending Balance. I reviewed the information on ROI calculation in the Investopedia link you provided. As an investor, I have used this calculation many times. KMyMoney does not have the functionality to correctly make this ROI calculation. KmyMoney Handbook has the following statement about ROI in the Investment section: “Unimplemented Features There are some features that are normally associated with investments which are not yet implemented in KMyMoney. These include, but are not limited to derivatives, options, and futures. In addition, when you sell a security, KMyMoney does not know which specific shares you are selling, i.e., the oldest or the most recently purchased, so it cannot calculate return on investment. Finally, it has no direct knowledge about any country's specific tax reporting requirements, but these can usually be handled by marking as Tax related all the categories you use for transactions which might have tax consequences.” After reading this, I was curious how KMyMoney was able to do the ROI calculation for the Investment Capital Gains reports. I created another KMyMoney file with one investment account and put in several Buy and Sell transactions using made up numbers to see if I could figure out how the program was determining the buy value for each time shares were sold. It appears that the program is using a First In/First Out method (first shares bought are the first shares sold). Lacking the ability to identify the specific shares sold, this a reasonable but not accurate way to estimate capital gains. The gain is accurate only for the situation where the report date range includes all of the transaction dates and also all shares have been sold. The KMyMoney file I created included only Buy transactions for 2021. For 2022 I included one Buy transactions and two Sell transactions that sold all shares. Total Buy value for 2021 was $1295 and another $210 for 2022, for a grand total of $1505. The total Sell value was $1340. The ROI calculation is therefore ($1340 – $1505) / $1505 = a 10.96% loss. The Capital Gains report in KMyMoney matches this result. When I ran the Investment Performance report with a date range of All Dates, I see Beginning Balance $0, Buy Value $1505, Sell Value $1340, Ending Balance $0 and ROI of 10.96% loss, matching the Capital Gains report. However, a different result happens when I use the default report date range of Year to Date. In that case I see Beginning Balance of $1500, Buy Value $210, Sell Value $1340, Ending Balance $0 and ROI of 21.64% loss. Since all shares that were bought were sold, this is obviously an incorrect result. The problem is that the shares bought in 2021 had an increase in share price by the end of the year bringing the ending value of the shares to $1500. The Beginning Balance for 2022 should have been the ending Buy Value for 2021 of $1295, not the Investment Value based on the year end share price. There are two types of investment gains. When shares are sold we have “realized” gains as above. If not all shares are sold we also have “unrealized” gains. Unrealized gains are calculated as the increase or decrease in share value based on the current share price minus the buy value of the shares. Unrealized gains vary from day to day as share prices change due to market activity. Unrealized gains are part of the performance of an investment. The Investment Performance report does not use the unrealized gain value as the Ending Balance. Instead, it uses the full value of the shares at the ending price. This is wrong. The report calculates the ROI by adding the Ending Balance to the Sell Value. The Ending Balance needs to be the unrealized gain amount, not the ending shares value. A better title for Ending Balance would be Unrealized Gain/Loss. -- You are receiving this mail because: You are watching all bug changes.