Bug 312135 - Split Shares yields to wrong Investment Performance Reports
Summary: Split Shares yields to wrong Investment Performance Reports
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.6.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-23 21:13 UTC by Jan Ritzerfeld
Modified: 2018-03-28 08:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.0.0
Sentry Crash Report:


Attachments
An almost minimal kmy file showing the problem (5.75 KB, application/octet-stream)
2012-12-23 21:16 UTC, Jan Ritzerfeld
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Ritzerfeld 2012-12-23 21:13:48 UTC
I had to do a "Split shares" on two investments (1/10). While most values seem to be correct, now, the investment performance reports shows too big "Buys" values and, therefore, the " Annualized Return" and "Return On Investment" are both very negative while the other values in the report looks okay.
I copied the transactions of one affected investment to a newly created kmy file directly, i.e., I edited the xml file and copied all the prices, too. I will attach this little file.


Reproducible: Couldn't Reproduce

Steps to Reproduce:
I tried to reproduce the problem using an empty kmy file. However, without having quotes/prices for my fake buys and splits and not knowing how to enter them manually, really weird things happen.
Comment 1 Jan Ritzerfeld 2012-12-23 21:16:29 UTC
Created attachment 75990 [details]
An almost minimal kmy file showing the problem
Comment 2 Jan 2013-01-06 19:09:21 UTC
I just noticed the same problem:

My Performance Report for the year 2011 includes a line with a Share Split on July 13, 2011.  There were two Sell transactions before the split and one Buy transaction after the split:

01/31/11 Sell for 7598.88
02/25/11 Sell for 3031.75
07/13/11 Split 1/0.758783
12/02/11 Buy for 1868.51

In the report, the column "Sells" shows an amount -10630.63, which is correct (7598.88+3031.75 = 10630.63).  However, the column "Buys" shows an amount of 1948.26.  This is incorrect.  A split affetcs the number of shares, but not the total value.  Whatever the logic is concerning the number of shares, the amounts should always match.
Comment 3 Jan 2013-01-07 00:14:52 UTC
Further to the above, another investment with no transactions whatsoever during the reporting period other than a share split shows a nonzero amount for the shares bought.
Comment 4 Jan 2014-01-21 00:41:14 UTC
The Net Worth report computes the value of the shares at the start of the report period.  The value seems to be defined as the number of shares at the start of the period, multiplied by the last known price.  If a stock split intervened between the date of the last known price and the start of the reporting period, it is **not** applied to the price.  A possible fix is to find such splits and apply them, or, when a stock split operation is entered, apply it retroactively to all stored share prices and volumes.
Comment 5 wojnilowicz 2017-02-05 18:51:36 UTC
I loaded your .kmy and under buys there is -599.99 Euro which equals 7 x 75 Euro + 1 x 74,99 Euro, so probably this issue was fixed by 88173ce91714e57464b4db586eb3e395fd8e85cb.
Comment 6 Jan Ritzerfeld 2017-02-07 09:35:00 UTC
(In reply to NSLW from comment #5)
> I loaded your .kmy and under buys there is -599.99 Euro which equals 7 x 75
> Euro + 1 x 74,99 Euro, so probably this issue was fixed by
> 88173ce91714e57464b4db586eb3e395fd8e85cb.

Thank you very much!