Advanced portfolio report

Morrison J. Chang mjchang at ix.netcom.com
Tue Nov 27 23:01:11 EST 2007


On Tue, 2007-11-27 at 08:01 -0800, Andrew Sackville-West wrote:

> I'm curious to see what you did. I've also finished that part of the
> report... heh heh. In a nutshell: I've kept track of which splits have
> already been taken care of in a list and then only used a split in the
> basis calculation if we haven't seen it before. For the
> splits/mergers, I just run through the basis-list and total up the
> number of shares, work out the ratio and apply that ratio back through
> the list. That way the basis get recalculated for every "lot" in the
> basis list. 
> 

[too many meanings to the word split]
I've done something similar. I've made the assumption that only
ledger-splits on the same account and that have both a units and value
entry are worth dealing with. If it has units but no value - its a
stock-split/merger and a factor is applied to the basis list.

> > 
> > Are you doing a total rewrite or patching the current report?
> 
> not really a total rewrite, but some signigicant chunks are redone.
> 
> > 
> > If you are interested, I can send you my patch and/or post it to devel
> > list.
> 
> sure. I'm putting this email on the list. I'm just about done with
> mine and I'll post it up there as well. We can have dueling reports!
> 
Cue the banjo...

> > 
> > My version should handle splits and correctly calculate gain for
> > avg-basis, fifo, and filo. The issue with what I have now is some
> > rounding problems (probably due to using gnc-numeric) and I ignore
> > transaction values from income accounts since I don't know if there are
> > dividend or capital gain accounts.
> 
> There's really no way to tell about the income accounts,
> unfortunately. At least if its reinvested. I suppose if its not
> reinvested you could tell because its money in and money out, but no
> shares touched. That's pretty tricky though. 
> 
> THe rounding is easy. Look at bugzilla #343245, comment #2 attachment
> includes code to fix the rounding errors. Pretty straightforward.
> 
> 
Hmm ... did a quick search and replace using GNC-DEMON-AUTO (logior
GNC-DENOM-REDUCE GNC-RND-NEVER) instead of the usual 10000 GNC-RND-ROUND
but I seem to get some odd problems with display (like blank or
fractional entries in the realized gain column).

> What are you doing with commissions/brokerage fees?
> 

As of now nothing. At some point I figure I would stop mucking the with
the business rules and start adding a column or something as suggested
in prior posts.

> We should compare notes I think before either of us goes any farther
> so that we don't continue to duplicate efforts.

Agreed.

In any case I just found a test case that I'm failing on that I need to
fix before I'm ready to post.

-Morrison



More information about the gnucash-devel mailing list