GNOME Bugzilla – Bug 336240
advanced portfolio - the basis calculation is not working properly in funds
Last modified: 2018-06-29 21:00:34 UTC
Please describe the problem: In funds, the basis calculated dosesn't take intro account transactions with money coming from an income account ( this is the case for instance in France as this is a way for companies to give extra money from the benefits, without any taxes). Thus every ROI is wrong. Steps to reproduce: 1. create a fund with 10 shares of value 10 (total 100) with the money coming from an asset account : the basis is 100 2. use an income account instead : the basis is 0. Actual results: Expected results: Does this happen every time? Other information:
Would it be possible to fill in the "Actual Results" as well as the "Expected Results". If you also can describe the correct formula for how to calculate this it would be even better.
In the example above, the correct basis is 100 (total amount of money invested). I probably wasn't clear enough : the problem is not related to a wrong formula. there is somewhere in the code (probably in advanced-portfolio.scm around line 333 but my poor knowleldge of scheme prevents me to go further) where transactions with money coming from an income account are not used in the function to calculate the basis, but I think they should. In gnucash 1.8 the basis was not clearly calculated but the percentages of benefits related to the investments were right : it should be the same in the 1.9 version.
Created attachment 63451 [details] [review] patch for advanced portfolio improvements the partfolio now deals with income accounts to compute the basis, and there is now a new ROI.
some other explanations that I did not add with the patch : The report is modified that way: - the basis takes into account money coming from assets or income accounts - the dividends are now included in a more general notion : external investment - two new columns are displayed: the external investment and the global ROI on the other hand. the idea is to take into account the possibility to have shares or funds paid by someone else ( re-invested dividends or extra salary or whatever) . The return formulae are: personnal return= gain/(personnal money invested) ;;(external money is thus considered as gain - no change) global return= (gain-external money)/(money invested (own and other). this shows more or less the fund/actions performance
Created attachment 64985 [details] Data file to demo Adv Portf issues handling Splits If the patch earlier in this bug report is applied the Basis calculations are much improved. The attached data file demonstrates an additional problem with Stock Splits. The entry in the column "Realized Gain" is incorrect. If that entry is removed from the column "Basis" the report is correct. This data file is from the updates to the Concept Guide.
See also bug#343245
I think this is fixed in r16620. at least the basis portion of it, which is what the original bug report was about. Doing a simple purchase of shares with an income account adjusts the basis properly, though it does show a realized gain as well, which is not right. But that is another issue. ISTM that these types of purchases, from Income accounts, need to be passed through an interim account. We can't tell, at this time, what the purchase was made with -- reinvested dividends, regular income, etc etc. Anyway, I'm marking this as blocking the backport bug to that it gets closed when 16220 backports.
branches/2.2@r16663. Please mark the patch as obsolete or committed, whatever fits better.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=336240. Please update any external references or bookmarks.