Stocks & Capital Gains

Joshua Moore moorevineyard at
Fri Aug 10 13:41:47 EDT 2007

The email below is one of the more recent posts that I've found relating to 
tracking the cost basis of stocks.  Just to be clear, here's my situation.  
I have an old mutual fund that has had periodic investments for the past 10 
years and occasional sales.  The original way I calculated capital gains for 
any sales was by using an average cost basis (figured with a simple 
spreadsheet), not first-in-first-out.  It looks like gnucash does not have a 
built in way of handling this for a sale entry.  Is there a plan to include 
this functionality?  This also seems essential for someone who wants to 
"close the books" at the end of a fiscal year.  If the person is using an 
average cost basis for tax purposes, the value to carry forward into the new 
books needs to be based on average cost in order to calculate any future 
capital gains properly, right?

I've been puzzled by a few questions regarding using gnucash to track
stock investments.

The help file shows how to track the purchase, sale, and value of
stocks.  When recording the sale of the stock, one has to include an
amount from Income:Capital Gains representing the profit on the sale.
In order to know this amount, I need to track the cost of the shares.
For stocks, Gnucash seems to track the cost and unrealized gains
internally so that one does not need an account hierarchy like that
shown in the help file for the Degas painting.

How do I use gnucash to determine (possibly years and many individual
purchases later) what my cost was for the stock?

If I make a subaccount called cost, and use it in the purchase of the
stock, it shows a negative value.  Is this reasonable?

The cash shows as still being in the parent investment account.  In
fact, the amount of cash in just the parent investment account would
show the total cost of all stocks and cash in the account.  This does
not seem right, as I need to track the amount of actual cash in the
investment account, too.

In Canada, the commision to buy and sell the stock is added to the
"adjusted cost base".  So I don't wish to show commisions as simply an
expense account.  Should I record it as an expense and then record
another transaction from Income:capital gains to reduce the gains by the
amount of the commision?  This would certainly work for the sell
commision.  I would need a way to track the buy commision as part of the
cost of the stock without altering the price per share.

How does one handle consolidations and splits of the number of shares of
stock?  We have a number of exchange traded funds in Canada which do odd
things with their capital gains.  So that the fund is not liable for
capital gains taxes, they distribute their capital gains to the share
holders.  The shareholders then pay the capital gains (and the amount of
the gain is added to the "adjusted cost base" of the shares due to the
following).  The distributed capital gains are reinvested in shares of
the fund.  Immediately, a consolidation is done so that the ending
number of shares is identical to the number of shares prior to the
capital gains distribution.  The price of the shares and number
consolidated is not known, only the amount of the capital gains
distribution.  (I have previously recorded these in Quicken using
arbitrary numbers of shares since the important part is how this affects
my cost of the shares, rather than the exact number of shares.)  This
produces odd numbers in a consolidation, such as 101 shares consolidated
into 100.

Clearly, it is important (and nontrivial) to track the cost of these
shares for tax purposes.  (I note that Quicken and my brokerage do not
agree on the cost basis of these shares in my RSP.  For nonregistered
accounts, the broker does not calculate the cost basis, and I must do it


See what you’re getting into…before you go there

More information about the gnucash-devel mailing list