Advanced portfolio report

Morrison J. Chang mjchang at
Sat Dec 1 17:36:46 EST 2007

On Fri, 2007-11-30 at 08:14 -0800, Andrew Sackville-West wrote:
> On Thu, Nov 29, 2007 at 10:05:15PM -0500, Morrison J. Chang wrote:
> > On Thu, 2007-11-29 at 12:32 -0800, Andrew Sackville-West wrote:
> > > > whoops, that version is broken, disregard. 
> > > 
> > > here is one that actually works ;)
> > > 
> > > comments please
> > > 
> > 
> > I'll make my code comments in my response to your comments.
> > (In any case both of us are still failing cases..)
> > 
> > Attached is copy of my test file.
> > 
> > Looking at the report entry for Vanguard Test.
> > 
> > With the NAV value as 62.00
> > I see a Money In as 997.50 which doesn't seem right.
> you're right. I've got a dividend collector (dividendcoll, was in the
> original report) sitting unused. It needs to be 'merge-ed into the
> money-in collector to make that work properly. I left it floating
> there as I'm still not really sure how to handle that whole income
> thing. And it also depends on exactly what "money-in" is. If its truly
> all money that moves "into" the account then that dividend income
> should be 'merged back in to the moneyin-coll. I'll post this simple
> change later today.
> Another possibility that occurs to me is to create YAColumn for
> "Income". That would count all income txn-splits in the account. That
> doesn't solve the IRA contribution problem, but does break out how
> much of the return comes from dividends and allows the gain to be
> clean of that money. 
> Really that might solve a lot of problems. RIght now gain is
> calculated from the current value and money-in or basis depending on
> which gain is being calculated. But reinvested dividends increase the
> value but shouldn't cause a gain. That dividend-coll should be
> substracted from the gain numbers and then listed separately so its
> clear. 
> Then the IRA question becomes simple -- the user has to move that
> money into an interim account before it moves into the stock. That
> makes it no longer look like income relative to the stock and *also*
> probably more accurately reflects reality -- those paymetns are always
> delayed.
The only problem that I have with an Income column and to a lesser
extent Expense is that Income could be both dividend income and capital
gains which is treated separately under US tax law. A user can extract
the different incomes out of their Income Statement report. I just don't
want to confuse novices looking at the report for the first time.

> 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 

Tried out your test case and saw the problem. Since I think you have a
bit more time, lets just commit yours so that something reasonably
correct exists for the next release.

My only request is that in the comments in report that the various
report fields are defined.

This is what I was aiming for with mine:

basis (current) = purchase basis value - sold basis value
value (current) = current basis quantity * current price
money in = purchase values into account
money out = sold value
realized gain = sold value - sold basis value
unrealized gain = current value - adjusted basis
total gain = realized gain + unrealized gain
total return = (realized gain + unrealized gain) / money in

Mainly as an aid to those who aren't use to reading prefix
notation/scheme code.

Still not sure what to do about the include income/gain checkbox.


More information about the gnucash-devel mailing list