Advanced portfolio report
Derek Atkins
warlord at MIT.EDU
Fri Nov 30 14:14:08 EST 2007
Mike? Are you using 2.0 or 2.2?
-derek
Quoting Mike Alexander <mta at umich.edu>:
> --On November 30, 2007 8:14:54 AM -0800 Andrew Sackville-West
> <ajswest at mindspring.com> wrote:
>
>> I think the thing to do is figure out which version of this report to
>> use and get it cleaned up and committed as it currently stands. Then
>> go back in and add the feature of another frickin' column. How many is
>> too many?
>>
>> The current report is so broken, that I think we could get the devs to
>> backport a fixed version into 2.2.x to help alleviate the current bug
>> stack and then move with improvements to the report for 2.4
>
> I decided to take a look at this a bit, although I don't have time to
> really do too much right now. So far I've tried Andrew's but not
> Morrison's. To get it to work I had to change "_" to "-" in
> ACCT_TYPE_ASSET and ACCT_TYPE_LIABILITY around line 390 in case anyone
> else is wondering why it doesn't work as sent. I also changed the
> debugging calls to use "gnc:debug" instead of "output" to avoid getting
> 15000 lines of debugging output every time I ran the report.
>
> There are still some problems with this report. For one thing it
> doesn't seem to handle reinvested dividends quite right, although I
> think you've been discussing this. I have a fund where I made one
> purchase and since then there have been reinvested dividends and
> reinvested capital gain distributions and no sales. It didn't handle
> this too badly. The basis seems correct, but for some reason all the
> dividends and distributed gains are considered to be realized gains.
> In the case, at least, of the dividends this is not right.
>
> In the case of Apple, I've got a number of purchases and sales over
> several years, along with a few stock splits. However the net result
> is fairly simple. All the lots are closed except for the most recent
> purchase and there have been no splits since then. It almost handles
> this correctly except for some shares I donated to charities. For some
> reason it considers the value of these shares to be brokerage fees. I
> used the lot scrubber to create capital gains splits for all the sales
> and donations and told the report to use them. The realized gain in
> the report is the same as in the lot viewer.
>
> A more complicated example is Altria Group. I purchased two lots in
> 2004 and 2005. In 2007 they spun off Kraft. There have been no other
> transactions in that account. The net result is that the basis for
> Altria is split between the Altria and Kraft stocks. Then the
> resulting fractional shares of Kraft were sold. I used the lot
> scrubber to create capital gains splits for this fractional sale. The
> report doesn't handle this well at all. The basis of Altria is
> unaffected by the spin off instead of being reduced. The basis of
> Kraft is close, it's off by only $.74. I can't see any obvious place
> this comes from. However it shows a realized gain for Kraft that is
> way off. It's equal to all the money that has flowed in or out plus
> $.74 so it's off by a factor of 1000 or so.
>
> I also have another stock (Johnson & Johnson) for which I have 3
> acquisitions, one partial sale, and several splits. It seems to have
> had trouble with this one since it thinks the basis is zero, which is
> clearly wrong. Again I used the lot scrubber to create a capital gains
> split for the sale and the lot scrubber gets the correct gain. The
> report shows a huge realized loss that is much larger than the sale
> price, as if the basis for that lot was a large negative number.
>
> If there are lots assigned to the splits for a stock or other asset,
> the report should use them. In this last case, the sale was part of
> the second of three acquisitions. This is correctly recorded in the
> splits (which I realize is hard to do now, but someday it might be
> easier) and the report should really use this information to determine
> the basis for the shares sold like the lot scrubber does.
>
> I've only looked at a few lines in the report so this isn't a complete
> list of the possible problems. Sorry I don't have more time to work on
> this right now. I appreciate the work you are doing on it. This
> version seems to be better than before and I hope these comments help
> improve it. I'm sure you would like to have test data that
> demonstrates some of these problems. Perhaps I'll have time to create
> some, but I can't promise it right now.
>
> --
> Mike Alexander mta at umich.edu
> Ann Arbor, MI PGP key ID: BEA343A6
>
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the gnucash-devel
mailing list