Stock trades and realized gains/losses

Matthew Vanecek mevanecek@yahoo.com
08 Jan 2003 23:57:21 -0600


--=-tUlZ8O2+r94Ol8VAXZiH
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

I've done some research, and I've watched the various and sundry threads
and IRC conversations regarding stock trades, gains/loss accounting, and
Lots.  I've reached a conclusion that I hope I can persuade others to
come to as well.  That conclusion is that we should be tracking the
dollar amounts of securities, relegating the quantities to an ancillary
position (e.g., part of a Lot).

First, let me start off by summarizing the current direction, as I
understand it. Derek is developing a concept known as "Lots".  The Lots
will allow purchases and sales to be grouped together.  This allows the
FIFO concept of accounting for investments.  It associates a sale with a
specific purchase, and lets you calculate gains/loss accurately (as
opposed to a weighted average--which, for the record, I oppose).  You
also have the option of realizing a gain against a high-cost purchase,
thereby minimizing the gain.  Nifty for tax purposes.

All that is wonderful, and I'm really looking forward to it.  However,
it fails to properly record the monetary numbers in an account.  The
current CVS implementation cannot properly balance a transaction that
includes a realized gain. That's because a stock account balance is
recorded in number of shares, and you logically cannot sell more shares
than you own.  For a gain, this is problematic.  If I buy 10 shares for
$100, and then sell 10 shares for $110, how to I balance the gain?=20
Well, that's what I hope to answer below.  It will, however, require a
return of currency to a stock account.  Please read on...

My proposal is this: track the *number* of shares in the Lot, and the
*dollars* of shares in the Stock account.  This will allow proper
accounting of the money trail, while also tracking numbers of shares.=20
It has the side benefit of *not* backtracking to the 1.6.x model of a
Security and Currency per account.

I'd like to reference a couple of sources to support this.  First,
http://www.nysscpa.org/cpajournal/2002/0802/dept/d085602.htm provides
some insight into how Lots can help, and also some implication about how
they should be recorded in an accounting system.  It deals specifically
with portfolio accounting for indivual investors, which most of us
qualify as.  If nothing else, it provides an excellent introduction to
the subject.

The other source I reference is the Wiley GAAP 2003, subt.
"Interpretation and Application of GENERALLY ACCEPTED ACCOUNTING
PRINCIPLES 2003", pub. by John Wiley & Sons, 2002.  You ought to be able
to find it at a local Barnes & Noble, or perhaps it's already at the
library. Specifically of interest is Ch. 10, "Investments".

Ok.  An objective review will show that the above sources back my
proposal.  The CPA Journal article (Example 3, specifically) points out
that calculating gains/losses and properly recording those is one of the
areas most likely to cause discrepancies.  It uses an Asset account,
"Cost of Investment", to record the monetary amount of stock purchases.=20
The number of shares purchased and the price/share is recorded in the
Lot. (as an aside, stock splits could also be recorded in Lots, since
they don't change the value any).  Now, suppose you sell the stock for a
profit.  The CPA journal suggests a "Margin Liability" liability account
in which to record the net proceeds of the sale (e.g., after transaction
fees).  The Cost Of Investments Asset account is credited the original
purchase price.  The "Cumulative Profits" account is credited the
realized gain.  This results in a balanced transactions.  Referring to
the CPA Journal article, the reduction in the number of shares is
recorded in the Lots, while the actual dollar amounts are recorded the
various accounts.

Referring to the GAAP reference, the first section of Ch. 10 covers
basic equity investment accounting.  It is much more granular, perhaps,
than is strictly necessary.  Following it closely, however, would yield
a strikingly accurate picture of your financial status.  Anyhow, it
presents several examples of double-entry for equity security trades,
transfers, and sales.  Profits/loss increase/decrease the realized gains
(loss) income accounts, and decrease the various "Investment in equity
securities" asset accounts (held-for-trading, available-for-sale, etc)
Cash received, of course, is recorded in the appropriate bank account.

Now, referring to the CPA Journal article, I doubt that many of us buy a
whole lot on margin, which begs the question, what to use instead of the
"Margin Liability" liability account?  Well, referring to the GAAP, one
can infer that the "Margin Liability" account should be replaced as
appropriate to your situation.  In my case, I would debit Cash, since
that's where the money goes (I don't buy on margin). So, putting
together these concepts, we can picture the following two transactions.=20
The first is a buy, and the second is a sale.


Assets
    Cash
    COI

Income
    RG(L)

Account         Debit   Credit      Bal
------------------------------------------
Cash                    100         100
COI             100                 100    <--- 10 shares @ $10
------------------------------------------
RG(L)                   100         100
Cash            200                 100    <--- 10 shares @ $20
COI                     100         0
=20
In the above, the number of shares and the price/share is ancillary
information, and properly belongs in the Lot attributes.  Therefore, in
our "Stock" accounts, we should be tracking the currencty amount instead
of the number of shares.  And you can use just one COI account for many
different stocks.

Now, from an implementation perspective, it certainly makes sense to
follow the generally accepted accounting principles.  To track the
dollar amount *instead* of number of shares alleviates the current
multi-currency issues with stock accounts.  It makes life somewhat
easier when generating reports--there is no longer a need to run through
many Lots to get a total of realized gains/losses for a period.  You can
see at a glance the dollar amounts for gains/losses and current invested
amount.  Net worth calculations are also simpler to implement.  Also,
Accountants generally are more interested in dollar amounts, not number
of shares (I've seen many questions from Gnucash users about how to get
info in a form appropriate for Accountants).  And to retrieve the number
of shares and other Lot information, all you have to do is add the
Transaction GUID to the GUID list in whatever Lot, or possibly more
appropriately, add the GUID of the Lot as an attribute of the
Transaction (foreign key, as it were).

I don't know how far Derek has gotten on the Lot development.  I
believe, though, that it should be relatively easy to update the
implementation to the above proposal.  The benefits far outweigh the
cost of development.  It eases accounting for investments.  It will be
more intuitive.  It presents an opportunity to align with proper
accounting procedures, and provides the flexibility to the users to be
able to do so.  We would want to record the number of shares in the Lot,
of course, but that is a required interface in any case.  The security
mnemonic could also be stored in the Lot, which would allow us to
combine security investments in one account, instead of a separate
account for each security.

In the current register, as far as I can tell, the only immediate change
that should be made is to record a dollar amount in Balance instead of a
number of shares.  That's the first step torwards aligning with
accounting practices.  Derek's work with Lots will go a long way to
making this a reality, if he agrees with my assessment (well, he *is*
the one writing the code!).

Well, I think that about covers it for now.  Proper accounting
practices, user satisfaction, ease of implementation, all based on
common and approved (and logical) accounting practices.

Can we do it this way?
--=20
Matthew Vanecek
perl -e 'print $i=3Dpack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
***************************************************************************=
*****
For 93 million miles, there is nothing between the sun and my shadow except=
 me.
I'm always getting in the way of something...

--=-tUlZ8O2+r94Ol8VAXZiH
Content-Type: application/DEFANGED-7833; name="signature_asc.DEFANGED-7833"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA+HQ9Ai/CNzDSN0RIRAir3AJ9CjfVKm7iQ711Wlz0f/vAJjqFpGwCglgbb
R+z5l/NyrAATN5of2aRQs9I=
=8LVO
-----END PGP SIGNATURE-----

--=-tUlZ8O2+r94Ol8VAXZiH--