Balance sheet, stock sale, unrealized gain or loss

Errol Siegel errol at bitterkitten.com
Wed Jan 17 20:05:21 EST 2007


Thanks for the info, but this still leaves some important questions in my
mind:

It is clear that this problem has been around for many releases.  Why hasn't
it been addressed?  Is there a reason why this hasn't been fixed?  Does this
fix cause problems with other parts of gnucash?

-----Original Message-----
From: David G Hamblen [mailto:dhamblen at adelphia.net] 
Sent: Monday, January 15, 2007 7:50 AM
To: David Brock
Cc: errol at bitterkitten.com; gnucash-user at gnucash.org
Subject: Re: Balance sheet, stock sale, unrealized gain or loss


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.
>>
> 


--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the gnucash-user mailing list