Balance sheet, stock sale, unrealized gain or loss
David G Hamblen
dhamblen at adelphia.net
Sun Jan 14 09:04:23 EST 2007
I was able to make things balance by removing all the numeric-abs
functions from the file /usr/share/gnucash/scm/commodity-utilities.scm.
I then had to fix a potential divide-by zero somewhere around line 390
in report-utilities.scm in the same directory.
I have no idea why average values are being computed using absolute
values of the share and cost data, but this fixes it for me. I also
don't understand scheme, etc; so I don't know if my changes impact
anything else.
I've got some notes to myself lying around somewhere (maybe even a
patch), which I could try to locate if anyone's interested.
dave
Errol Siegel wrote:
> I have been using GnuCash for many releases and noticed right away that
> I could not get a balance sheet to balance once I sold any stock.
>
> I am now trying the 2.0 release and I am seeing the same symptoms.
>
> I want to describe again what I have done to make sure that I am not
> missing something.
>
> I set up an example file where I have a checking account starting
> balance of $1,000.
>
> I purchase 10 shares of stock at $10 per share out of the checking
> account.
>
> The next day I purchase 20 shares of stock at $5 per share out of the
> checking account.
>
> The day after that I sell 13 shares of stock at $4 per share.
>
> If I use the Lot Viewer to "scrub account" then it adds a transaction to
> account for the $60 loss from selling the initial 10 shares and a
> transaction to account for the $3 loss from selling 3 shares from the
> purchase of 20 shares.
>
> I entered entries for this stock manually in the price editor for each
> of the days that there were transactions (I used the NAV option).
>
> I created balance sheets using all three options for the commodities
> values.
>
> Weighted average:
>
> This shows the current value of the asset as a weighted average, but
> does not calculate an unrealized loss at all, so the report does not
> balance.
>
> Most recent:
>
> This shows the current value of the asset based on the most recent entry
> in the price editor, but shows the unrealized loss as $56.53 so the
> report does not balance.
>
> Unless I'm mistaken, the unrealized loss should be $17. I still have 17
> of the shares I purchased at $5 per share, but they are now only worth
> $4 per share.
>
> Nearest in time:
>
> This still shows the current value of the asset based on the most recent
> entry in the price editor ($68) and it shows an unrealized loss of
> $56.53. This is the same as what "Most recent" showed. I don't
> understand how these numbers were calculated (or how they were supposed
> to be calculated).
>
> Am I doing something wrong?
>
>
More information about the gnucash-devel
mailing list