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))
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?
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
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel