Bug 392755 - Suggestion: Category for realized profit/loss of an investment
Summary: Suggestion: Category for realized profit/loss of an investment
Status: REPORTED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.8.1
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-05 12:17 UTC by Christian
Modified: 2022-12-06 16:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian 2018-04-05 12:17:53 UTC
Suggestion: When selling an investment, calculate the realized profit or loss and assign a category to it.

Motivation: It would be nice to have the investment "returns" in a category, so that they show up in the Income/Expenses views. Also, for the accounting, where the balance sheet shows the current state of all assets, and the difference from one year to the next is captured in the categories (Income, Expenses), there has to be a category where this realized profit/loss is captured, otherwise the differences in the balance sheet and in the "bottom-line" of the income-expenses do not match.

Implementation: I think that this realized profit/loss is usually calculated by tracking the purchasing price of the oldest asset still held.

Example 1:
1.1.2016 Buy 10 shares of XYZ at 5 per share (transaction value 50)
1.1.2017 Buy 5 shares of XYZ at 7 per share (transaction value 35)
1.1.2018 Sell 15 shares of XYZ at 9 per share (transaction value 135)
--> Here, the purchase value was 85, the sales value 135, i.e. a profit of 50. There should be a category where this is shown as 50.

Example 2:
1.1.2016 Buy 10 shares of XYZ at 5 per share (transaction value 50)
1.1.2017 Buy 5 shares of XYZ at 7 per share (transaction value 35)
1.1.2018 Sell 5 shares of XYZ at 9 per share (transaction value 45)
--> This would be a profit of 20 because those 5 shares were bought 1.1.2016 at price 5. There should be a category where this is assigned to.
1.3.2018 Sell 10 shares of XYZ at 10 per share (transaction value 100)
--> This would be a profit of 40 because 5 shares were bought 1.1.2016 and 5 on 1.1.2017.
Comment 1 NSLW 2018-04-06 12:50:08 UTC
Have you tested 5.0 for this feature?
I would rather see that in reporting module than anywhere else.
Comment 2 Christian 2018-04-06 16:06:55 UTC
Upgraded to 5.0.1.  There, I can see that it's possible to specify a category for "Interest", which I can use to add an amount to the "Sell" transaction so that it shows up in a category.

However, there is a problem with this. The amount I enter for that category is added to the transaction amount. With a profit (loss) of selling the investment, the amount that I want to categorize is already included in the transaction amount. If I write it into the "Interest" field, the transaction total is wrong.

Suggestion: Add another field that is called "Profit/loss", where I can specify an amount that does not modify the total.

My previous Example 1 could then be entered as:
Sell 15 shares of XYZ at 9 per share - total is 135. In the new input for Profit/loss, enter the Category and the value 50.

With the current setup, I can enter a category for Interest and enter 50 there, but then the total changes to 185, i.e. the Profit is counted twice.  My only alternative then is to leave the share price at its buying value to avoid the double-counting, but that is an unattractive workaround.
Comment 3 NSLW 2018-04-06 16:19:59 UTC
I don't know why you desperately need it as category, but you can have your profits and losses reported as performance report. There you have some predefined options to count your profits.
Comment 4 Christian 2018-04-06 18:16:40 UTC
Well, I see profits as a Category under Income. It would be nice if all the Categories under Income add up to the total Income, and all the Categories under Expenses add up to the total Expenses. So that the grand total (sum of Incomes minus Sum of Expenses) corresponds to the change in the total of Assets and Liabilities. That's the way it's usually done in accounting, I think, i.e., if I have the totals of the Assets and Liabilities for end of years 2016 and 2017, for example, then the difference between these years should match the grand total of Income Minus Expenses.

Without the Category for the Profit/Loss, I cannot get the difference in the assets from one year to the next match the Income Minus Expenses.
Comment 5 mahueb55 2018-04-07 00:25:58 UTC
While I understand the issue and do agree that the profits should show as an income category (and losses as expense, accordingly) I am not sure whether I agree with the requested solution. The example no. 2 Christian gave is ONE way to value inventory (of securities, in that case) - FIFO, but it is certainly not the only one. Who says that the 5 shares that were sold on 2018-01-01 are the ones bought in 2016?

From my point of view, the ideal target situation is:
- add the possibility to configure the valuation method (LIFO, FIFO, AVG, ?) per security
- add the possibility to configure a category for  "gain/loss from sale of securities" (or one category for gains and a separate one for losses) - globally, per investment account or per security (to be discussed)
- then, when posting the sell transaction, derive the net gain or loss incurred through the sales transaction automatically based on the configured valuation method and
- automatically split the transaction and assign the gain/loss fraction of the transaction to the category configured above.

That way, we're ensuring consistency. If we manually entered the gain or loss instead we could end up with inconsistencies pretty fast because we would not be able to guarantee that (buy transaction value) + (manually entered gain/loss) = (sell transaction value). Or am I missing something?

Sidenote: It probably makes sense not to allow changes of the valuation method as long as there is any nonzero number of shares of that security on our books because past transactions would need to be revaluated in order to arrive at correct & consistent values otherwise.
Comment 6 Christian 2018-04-07 05:59:22 UTC
The solution suggested by mahueb55 is a good one. It can be implemented in two steps:
1. Add the possibility to configure a category for "gain/loss" - whether globally, per investment account, or per security can be discussed.
2. Decide how to calculate the profit/loss automatically and implement that. (This could be optional or replace a temporary solution of entering this value manually.)

There is the possibility of entering inconsistent values if they are entered manually and (2) is not implemented. But to me this doesn't pose a problem as the current method (which would be equivalent to having a 0 profit/loss always) seems to be inconsistent in the same way.

Another reason why it would be good to have the realized profit/loss in a category is that some taxes are calculated on it (e.g., "capital gains tax").
Comment 7 Christian 2018-05-04 18:50:18 UTC
See bug 393204 for a related wish for enhancement concerning the overall profits/losses associated with an equity. The suggestion of the present bug concerns individual transactions, but there is some overlap to the other bug.
Comment 8 Justin Zobel 2022-11-21 08:22:17 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 9 Jack 2022-12-06 01:31:45 UTC
I'm changing this to a wishlist, and marking REPORTED, as it can provide input to the eventual rework on Investments.  It seems unlikely that profits (capital gains) can be represented as a Category, since categories provide a label for money coming into or going out of an account.  Selling an equity/stock is just exchanging some shares of that equity in one account for cash in a brokerage account.  Recognition and tracking/reporting of capital gains/losses will require a significant enhancement to how ownership of equities is actually handled within Investment accounts.
Comment 10 Jack 2022-12-06 16:16:17 UTC
Adjusting title, since version doesn't matter.