PATCH: Advanced portfolio report revisions

Andrew Sackville-West ajswest at
Mon Dec 3 22:14:14 EST 2007

Hi guys, 

Attached here is a patch to the advanced portfolio report. It is not
complete, but at 630 lines, I don't want to get too much farther
without putting up some useable code.

This report works. That is to say, it doesn't crash any of my test
files and it provides reasonably consistent, predictable results. It
is also very much a work in progress: it has lots of ultimately
unnecessary comments that help describe what is happening and where
the problems are; it has some "stubs" (comments) where future
functionality could go; it does not handle some of the cases discussed
here and on IRC. But that said, it is, I think, way better than the
current report. It should close several bugs.

Bugs fixed: 

* double-counting basis adjustments for buys and sells that touch the
  account more than once (bug #347739)
* charging donated or otherwise "expensed" shares to brokerage
  (reported to -devel by Mike Alexander)
* crashing on swig smob comparisons (bug #460232)
* failing on stock splits/mergers (bug #343245)
* some rounding errors (code ripped off from a patch supplied at #343245)

Not done:

* Properly handle spinoffs (partly done)
* Using lots for basis calculation when appropriate
* properly identifying/understanding the differences between all the
  different sorts of income/expense that can occur. For example, IRA
  contributions recieved directly from an employer currently appear to
  be a dividend.
* general cleanup of the report (lots of cruft in there)
* review documentation to ensure that these txns get entered in a
  predictable manner to aid in getting this report to behave.
* more?

As I said, I don't want to get to much farther down the road without
some checks on what I'm doing. Also, I'd like to see a report that is
in a position to be backported since the current stable report is a

I'd like to move forward and work on implementing lots (got a test
file yet Mike?), finish the spinoffs and at least *try* to figure out
how else to identify these txns (may require digging farther into
gnucash? not sure). But I'd like to do so from a "fixed" report
instead of continuing to diverge from the original. 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: advanced-portfolio.patch
Type: text/x-diff
Size: 28664 bytes
Desc: not available
Url : 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : 

More information about the gnucash-devel mailing list