Implementing proper cost basis tracking for shares

Robert Graham Merkel rgmerk@mira.net
Thu, 19 Oct 2000 13:30:24 +1100


Dave Peticolas writes:
 > Robert Graham Merkel writes:
 > > A while ago (check the mail archives), we had a discussion on 
 > > share reporting, and specifically, calculating share cost basis.
 > > The upshot was that we need to track which parcel of shares a share
 > > sale comes from.  With the new file format and hash store now
 > > available, it's time to think about doing it.
 > > 
 > > As far as I can see, all we need is for each share account to
 > > store a table with the details of the currently owned parcels,
 > > and each "sell" transaction to contain the details of which parcels
 > > have been sold.
 > 
 > Isn't that a reporting issue? I believe you can decide after the fact
 > whether you are going to do LIFO or FIFO or some other form of
 > tracking, so keeping that information in a permanent table seems like
 > too much overhead. Can't we always compute the table from the list of
 > splits in the stock account?
 > 

As I understand it, you don't have to *always* use LIFO
or FIFO or some fixed rule for doing this - you can pick and choose,
and as I understand things you can pick an arbitrary division for any
particular share sale - and people do, because it can have subsantial 
tax implications.  There are presumably rules about this kind of
thing, but I don't know them and GnuCash doesn't need to know them.

Provided you keep track of which rule (or which parcels if you're not
using a rule) was used for each stock sale, you don't really need the
table.  However, if you don't have the table, if you want to do a sale
where you specify the parcels (or fractions of parcels) directly, you
need to examine every transaction in the account to figure out what 
parcels of the stock you currently own.  If you regard doing this (and
the consequent delay while the parcel list is built up) as
acceptable, the table is not necessary.

However, if you go through and retrospectively change the parcels that
are sold, you need to go through and check every subsequent sell order
for consistency anyway . . . so whatever we do, to enable GnuCash to
support these sorts of accounting games is going to involve a bit of
complexity, and the code will chew up a few computrons :)

 > 
 > > The next question is "how do we track income and expenses related to
 > > a particular share account?", such as dividend payments, brokerage
 > > fees and the like.  My initial suggestion is for each share account
 > > to contain a "accounts containing income/expense transactions
 > > related to this account" list, and each transaction related to
 > > a share account should have a "Hi, I'm a <share account foo>
 > > transaction".  The other alternative is to insist that dedicated
 > > account(s) be set up so that every expense and all income related
 > > to trading a particular stock should be placed in those accounts.
 > 
 > It starts to get complicated, but maybe there's no other way around
 > it. Should the "Hi, I'm a ..." tag be for transactions or splits?
 > Example: you buy x shares of A and y shares of B with one check,
 > with two brokerage fees, one for A and one for B.
 > 

You're right, I think.  The tag should be at the split level if we go
that way.  Do you think that the tag scheme is the better way to go?

------------------------------------------------------------
Robert Merkel	                           rgmerk@mira.net

------------------------------------------------------------