[Patch] reworked advanced-portfolio.scm

Andrew Sackville-West andrew at farwestbilliards.com
Tue Feb 21 21:51:57 EST 2006


On Tue, 21 Feb 2006 19:14:33 -0700
Mark Johnson <mrj001 at shaw.ca> wrote:

> Andrew Sackville-West wrote:
> 
> >Alright gang, so here's the sit. on the advanced-portfolio report:
> >
> >I'm rewriting it so that it tracks two sets of prices in parallel buy checking the pricedb and the txn's themselves. Then report back the numbers based on whichever of these two prices is "closer" to the report date. The idea being that it will provide the latest price information we can find relative to the date of the report.
> >
> >Once that's working, I'll look into currency exchanges. but that's another story. 
> >
> >As it stands now, it will report out:
> >
> >total money in (the total amount of money flowing into the stock)
> >total money out (the total money out of the stock)
> >unit (total number of shares held at report date)
> >price (with a flag as to whether its a pricedb entry or a txn price)
> >value (price*unit)
> >gain (see below)
> >return (hmmm... below)
> >
> >gain: what do we want to see here? value - money in? that's not right, what if some stock was sold... okay, value -(money in-money out)? not right either. It should be value -(on-hand-lots-money-in) where on-hand-lots-money is the purchase price of the lots still held in account. That's complicated at best. Any ideas for what gain should be? 
> >
> >A
> >  
> >
> It's actually more complicated still.  In Canada, we don't track lots of 
> shares bought.  We just go by the average price.  This makes a 
> modification of the first calculation:
> value - ((money in) - (cost basis of shares sold out))

okay, I think I see how this can be done. value = moneyin - (moneyin/(total # bought shares)* current shares held)

> the correct one.  (I doubt "value - (money in - money out)" is ever 
> correct, as the money out includes realized gains.)
> 
> As far as lots on hand go, is it first-in-first-out or 
> first-in-last-out?  Does this vary from country to country?

I know this varies. I think in the US (been too long since I held stock) you can decide either way and of course the advantage of one over the other varies depending on who's writing the tax laws this year. 

This could get really complicated. I guess the report shouldn't even show money-in or money out, just a cost basis for the shares, current value, gain and return. Then the basis column makes sense regardless of the method used for calculation. thoughts?

A

> 
> It may be that this calculation will have to be based upon user-selected 
> report options (preferably in something persistent rather than having to 
> be selected every time).
> 
> Mark
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20060221/adc41682/attachment.bin


More information about the gnucash-devel mailing list