Hi: My problem is with the weighted-average computation causing the balance sheet to be unbalanced. This has nothing to do with the realized gain and "lots" issues which often come up on the list. The calculation seems to use absolute values when algebraic values would be more appropriate. Even if I knew how to program the scm modules, the relevant functions seem to be used in many places.
A sample set of transactions are as follows (each transaction is balanced by an appropriate amount in a Equity (or profit) account): 1 - Buy 100 shares of XYZ corp for $500 on 1/1/00, average cost=$5.00/share (ok) 2 - Sell all 100 shares of XYZ corp for $500 on 1/1/01, average cost = ($500+$500)/(100+100)= $5.00/share (ok, but should be undefined, just like ABC corp, which isn't even on my books!) 3 - Buy 10 shares of XYZ corp for $200 on 1/1/02, average cost = ($500+$500+$200)/(100+100+10)=$5.71/share (wrong, the average price of my holdings should be $20/share) The Gnucash Balance Sheet shows Total Assets of $57.10, based on the weighted average of absolute vales, and Total Equity of $200, leaving an imbalance of $142.86. If I use "Most Recent" or "Nearest in Time", the Asset values are then listed correctly, but then the "Unrealized Gains(Losses) line (which uses the weighted average) is too large by the $142.86 error. If anyone's interested, I have an test.xac file with just these entries. Dave _______________________________________________ gnucash-devel mailing list [EMAIL PROTECTED] http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel