Advanced portfolio report

Andrew Sackville-West ajswest at
Sat Dec 1 19:35:43 EST 2007

On Sat, Dec 01, 2007 at 06:29:03PM -0500, Morrison J. Chang wrote:
> On Sat, 2007-12-01 at 09:01 -0800, Andrew Sackville-West wrote:
> > On Fri, Nov 30, 2007 at 10:51:32PM -0500, Mike Alexander wrote:
> > > --On November 30, 2007 12:20:14 PM -0800 Andrew Sackville-West 
> > > <ajswest at> wrote:
> > >>
> [some good stuff about corporate splits]
> > On to lots:
> > 
> > >>> 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.


> > >> I honestly don't have a clue about lots and how they work.

snip ...

> > > Use of lots simply assigns a lot to each split that represents a purchase 
> > > or sale of shares.  For the purposes of your report all I'm asking is that 
> > > you ask each split what lot it is in and if you find a purchase and a sale 
> > > in the same lot, you use that purchase to compute the basis for the sale.  
> > > If the sale is not in a lot (or if you can't find the corresponding 
> > > purchase in the lot, which indicates a bug) then use the FIFO, LIFO, or 
> > > whatever rule to find the corresponding purchase.  It's pretty simple and 
> > > wouldn't complicate things much at all.  You can use xaccSplitGetLot to get 
> > > the lot a split is in.  Then, if this is not null, you can use 
> > > gnc-lot-get-split-list to get a list of splits in the lot.
> > 
> > 
> > Okay, I understand how that works. Basically I have to track the lots
> > along with the price and number of shares in the basis list. The
> > problem is how to deal with the "Average" basis. 


> > I'm not arguing against using lots here, BTW. Just trying to figure
> > out this corner case. 
> > 
> > hmmm... having just re-read all this, it may be as simple as
> > *ignoring* lots for the average-method, as it just doesn't apply.
> > 
> Andrew, you are correct. 
> FIFO and lots are cost basis calculations.
> Average basis is a different basis calculation.
> 'Once down the path of <basis> forever it will control your destiny' [or
> at least that account] 

okay. I follow that. Average basis is simply incompatible with the
idea of lots and can safely ignore lots. The other basis calculations
are aware of the timing of things and can use lots alongside the
regular FIFO/FILO calculation. 

snip good links to the revenooers...

> Of course since the report applies the same rule to all accounts
> regardless of intent, hopefully the user knows better and talks to their
> accountant or tax advisor.

At some point we have to allow the user to mess it up ;)

-------------- 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