Balance sheet, stock sale, unrealized gain or loss

David G Hamblen dhamblen at adelphia.net
Mon Jan 15 08:49:33 EST 2007


There was a thread back in January 2005 about this which (in March 2005) 
included a patch against 1.8.  Here's an attachment with the patch 
against 2.0.  I've changed the filenames so that I wouldn't overwrite 
the distributed version.  You'll need to copy the new files into place.


Dave




David Brock wrote:
> David-
> 
> I'd appreciate the notes, patch, or any other information that you have.
> I'm having the same problem, and trying to create a fix.
> 
> Thanks,
> 
> ;-David
> 
> On Sun, 2007-01-14 at 09:04 -0500, David G Hamblen wrote:
>> 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?
>>>
>>>
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
>>
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: balance-report-patch
Url: http://lists.gnucash.org/pipermail/gnucash-user/attachments/20070115/561b1530/attachment.pl 


More information about the gnucash-user mailing list