GNOME Bugzilla – Bug 632931
Advanced Portfolio: new income column shows negative amount, total gains does not include income, return is wrong
Last modified: 2018-06-29 22:46:12 UTC
Created attachment 173034 [details] Sample GnuCash to show problems with Advanced Portfolio Report The new advanced portfolio report has split the old "realized gain" column (that used to capture both income and capital gains) into 2 columns: income (from dividend, etc.) and realized gain (capital gains when selling). This is very nice but the problem is that the income is reported with a negative amount instead of a positive amount. Then the total gain is only reported as realized gain + unrealized gain but without including the income any more! Not surprisingly the total return is then completely wrong. Also in the old report, the expenses (brokerage fees) used to be removed, so the old realized gain was really income+realized capital gains-brokerage fees. In the new report, since the 2 have been split, it is no longer the same. But this also means that the brokerage fee is no longer removed from the total gain. To summarize with an example (sample GnuCash file attached) SAMPLE DATA: * Bought 1000 shares of VZ on 5/22/2009 at 28.81/share; sold 500 on 10/06/2010 at 30.22/share * Total dividend received as of 10/22/2010: $2602.50 * Capital gain from selling the shares: 500*(30.22-28.81)= $705 * Brokerage fees: $60 * Unrealized gains based on 10/22/2010 value of 31.99: 500*(31.99-28.81) = $1,590.00 GnuCash 2.2.9 Advanced Portfolio Report correctly shows: * Realized Gains: $3,247.50 (Indeed, that's $2602.50 + $705 - $60) * Unrealized Gains: $1,590.00 (correct) * Total Gain: 4,837.50 (Indeed 3,247.50 + $1,590.00) * Total Return: 16.77% GnuCash post 2.3.15 SVN Advanced Portfolio Report shows: * Income: -$2,602.50 (Negative amount!) * Realized Gains: $750 (correct) * Unrealized Gains: $1,590.00 (correct) * Total Gains: $2,295.00 (That is $1,590.00 + $750 BUT WHAT HAPPENED TO THE INCOME + the Brokerage fee is no longer removed from here...) * Total return: -1.07% (???) So basically the income shows as negative, then is not at all represented in the total gain. Then the total return is completely wrong of course... I have attached a sample GnuCash file with these transactions...
OK, so looking at the code I have some ideas that might help fix these problems... 1. Income data is collected from income accounts (obviously), but this means the numbers are negative since income accounts are on the "sell" side... So here all we need to do is systematically invert the sign... 2. Income is no longer reported in money out as it was before -- I assume this is intentional and it actually makes some sense compared to the current version. So now all the "gains" are really just about capital gains, hence I think we need to add yet another column that would give the full "total return" in currency amount (==total cap. gain + income - brokerage fees) then rename the current "total return" column to "rate of return" (or ROR or ROI). For clarity, I would probably put the columns in that order: Basis, Value, MoneyIn, MoneyOut, Realized Cap. Gain, Unrealized Cap. Gain, Total Cap. Gain, Income, Brokerage Fees, Total Return, Rate of Return 3. For the brokerage fee, I see that there is an option to calculate the return with or without considering the fee. When chosen, that means that the brokerage fees should be removed from the rate of return calculation but I guess it would still appear in the total return. I am actually not sure what the option NOT to include the fee is for--expenses/fees are actually paid so what is the relevance of calculating the return without them? I am not sure who is working on this report. I could work on a patch to implement these ideas if nobody is actively working on it... In any case, thanks for all the great work.
Created attachment 188725 [details] [review] patch addresses point 1
Comment on attachment 188725 [details] [review] patch addresses point 1 In r20784. I have also marked this one for backporting to 2.4. Thanks a lot !
...and backported to r20788 on the 2.4 branch by Christian. I'll leave this report open because there are still two points for improvement that weren't dealt with so far. The GnuCash project looks forward to your additional contributions :)
I have a related problem in 2.4.7: The currency conversion for the income is wrong. Example: My default currency for Gnucash generally and A-P is CHF. I own some shares of a Euro-fund that is traded in CHF on the Swiss Exchange. In A-P, the Price column indicates the correct currency. Dividends on that fund are paid out in EUR, so I added a transaction as described in bug 581191: ... Account |R| Share | Price | Buy | Sell ... --------------------------------------------------------------- Assets:Brokerage | | | | 111.76 | Assets:Investments:XXXX | | | 1 | | Incomes:Dividends:EUR | | | | | 111.76 In A-P, this dividend then shows up in the Income column as "CHF 111.76". It should either show up as "EUR 111.76" or as a CHF value with the exchange rate at the time the dividend was paid.
Created attachment 206856 [details] [review] patch for points 2-3 Well it's been some time... Here is a further patch on this. Point 2: indeed, I think "total return" should include income as well as (un)realized gains. The patch implements the layout as suggested in comment 1. Point 3: I am not sure either why you would want to exclude brokerage fees, but as it is an option... For now, I have changed the default value, so by default brokerage fees are taken into account. Also, for consistency as the new layout is organised so that the figures "add up", the "brokerage fees" column will not be displayed anymore if it is not taken into account. feedback welcome.. (note this patch does not address Stephan's problem, which seems different to me)
Comment on attachment 206856 [details] [review] patch for points 2-3 Thank you for your patch. I don't use the advanced portfolio report, but it looks technically correct (and I verified it runs without errors). So I have committed it both to trunk (r22018) and 2.4 (r22019).
@Stephan, I agree with Sebastien that you problem is unrelated. Can you please file this as a separate bugreport ? You can simply copy your comment into a new report. The rule of thumb is one report per bug, as this simplifies tracking of bugs. Thank you.
As the original bug is solved, I will mark this bug as such.
For the record, I submitted my bug (wrong currency in Income column) as Bug 670009.
Thank you very much to Sebastien for these patches, and for Geert for the follow up and commit. I have given the new report a first look and it looks good now. As I use this report in the next few weeks, I'll make sure to double check things a bit more to confirm it is all good.
I think it is useful to retain the "percentage return" and I think losing that information is a regression of the report. I do agree that indicating the amount of the return is also a useful data point. I'd like (at least an option) to display both amount of return and return percentage.
(In reply to comment #10) > For the record, I submitted my bug (wrong currency in Income column) as Bug > 670009. @Stephan: thanks.
(In reply to comment #12) > I think it is useful to retain the "percentage return" and I think losing that > information is a regression of the report. I do agree that indicating the > amount of the return is also a useful data point. I'd like (at least an > option) to display both amount of return and return percentage. Hello Derek, thanks for your feedback. With the patch, we do have both amount and percentage - however their meanings have changed slightly. Before the patch, the columns were: - total gain (amount) = realized gain + unrealized gain - total return (percentage) = (total gain - fees) / money in * 100 After the patch: - total gain unchanged - total return (is now an amount) = total gain + income - fees - rate of return (percentage) = total return / money in * 100 (in both versions, fees can be ignored via the option) However, you are right that we are not showing anymore the percentage for pure capital gain, excluding income. This can be added back of course. Do you think that would be useful as well? What would a good name be, "percentage gain"?
Derek, can you reply to Sebastien's question ? Thanks.
It mike make sense to also have a "rate of gain (percentage)"? Although I don't know if it makes sense. Someone else might have been using it.
I haven't used the report before, so I don't have any idea either. But since you reopened this bug, I considered you the right person to give more detailed feedback on what should happen next here in order to complete this bug. @Sebastien: does a "rate of gain (percentage)" make sense to you ? It does seem to fit nicely in the list of columns.
Created attachment 223191 [details] [review] add "rate of gain" column (In reply to comment #17) Hello, yes it makes sense. I have added it after the "Total Gain" column, see attached.
Comment on attachment 223191 [details] [review] add "rate of gain" column Thank you for your patch. I have committed in r22354 (trunk) and r22355 (2.4). This should complete the enhancement request.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=632931. Please update any external references or bookmarks.