accounting for stock trades

Derek Atkins warlord@MIT.EDU
02 Jan 2003 23:36:48 -0500


Ed Warnicke <hagbard@physics.rutgers.edu> writes:

> 1)    I purchase 100 shares of AMD with 500 USD on Date1.  This
> creates a transaction consisting of two splits:

Yes, but let me correct your syntax..  In particular, the split that
is attached to AMDAccount has an Amount of 100 (shared) and a Value or
$500 (the value of the purchase):

>         Transaction (Date1)
>         Description        Account        Debit    Credit
> Split-> Stock Purchase     CashAccount    $500      
> Split->                    AMDAccount              100shrs, $500


> where the commodity for CashAccount is USD and the commodity for
> AMDAccount is AMD.
> In addition to posting this transaction, we also post a Lot

Well, no..  The lot is not "posted" per se.  It's just something that
looks something like an account (in that it contains a bunch of
splits).  So, a corrected display would look like:

>                   Lot ( AMDAccount )
>                   Amount(Shares)       Value
> Split->           100                  500
> 
> It strikes me that a lot would be associated with exactly one account
> (AMDAccount in this example).

Indeed, a lot is necessarily tied to one account, and a split may only
be in one lot.

> ( By the way, do we have a better word than LotEntry for this? ).  A
> LotEntry is associated with exactly
> one date. By constrast a transaction is associated with exactly one
> date, and a Split is associated with
> exactly one account.  Because the sum over all LotEntry's of the
> Commodity ( not the AltCommodity ) is
> non-zero, this is an open lot.  Because it is an open lot it will be
> reported in the balance sheet as an
> unrealized gain/loss.

Well, not exactly.  A "Lot Entry" is a Split.  A Lot is just a way to
tie a set of transactions together by cross-referencing the set of
splits from one account.

An open lot shows that you still own some of the commodity (asset).
There may be an unrealized gain/loss based on the current "price" of
the asset -- you multiple the current price times the amount-balance
(shares) of the splits in the lot, and then subtract out the
value-balance of the splits in the lot.

> 2)    I sell 100 shares of AMD for 1000 USD on Date2.  This creates a
> transaction consisting of two splits:
>         Transaction ( Date 2)
>         Description        Account        Debit       Credit
> Split-> Stock Purchase     AMDAccount     100   
> Split->                    CashAccount                1000

This is correct...

> In addition we also post too the  Lot

Well, we link this transaction to the previous transaction by adding the
split to the lot (using my terminology):

>                   Lot ( AMDAccount )
>                   Amount(Shares)       Value
> Split->           100                  500
> Split->          -100                  -1000
> 
> The lot is now closed because the sum of Commodity over the Lot is now
> zero.  Because the Lot is
> now closed the sum over AltCommodity will be reported as a realized
> capital gain/loss in the balance sheet.
>
> Is this what you meant?  Please correct any inaccuracies you see here.

Correct.  The lot is closed because you have no shares left.  The
gain/loss is the sum of the values, which can be reported on the
balance sheet.

> Ed

-derek

> 
> 
> Derek Atkins wrote:
> 
> >Read my text: IMHO there IS NO SPLIT THAT REPRESENTS THE GAIN/LOSS.
> >The gain/loss is COMPUTED, based on the DIFFERENCE between purchases
> >and sales of a commodity LOT.  The lot is balanced when the number of
> >shares hit zero.  The gain/loss is the sum of the VALUES of all the
> >splits.
> >
> >For example, if a lot contains the following three splits:
> >
> >Amount(Shares)  Value
> > 50             500
> >-20             -400
> >-30             -150
> >
> >You will notice two things.
> >1) this lot is "closed" (it has an amount balance of zero)
> >2) you can compute the loss(gain) as the sum of the values: 500-400-150 = 50 gain
> >
> >You don't need a "balancing" split -- there is nothing to balance.
> >And no, I do NOT believe that you should have a single, unbalanced
> >split to denote losses or gains.
> >
> >-derek
> >
> >"Phillip Shelton" <shelton@usq.edu.au> writes:
> >
> >
> >>That still does not address where the balancing entry for the gain/loss is put. (At least it does not do it for me.)  And I thought that was the point of double entry accounting.  I will admit I am very new to the field of making money.
> >>
> >>Maybe, (And you would lean toward this, Derek?) capital gain is allowed to be "unbalanced"? The balancing entry is the reduction of the "hard" asset.
> >>
> >>-----Original Message-----
> >>The bug (IMHO) is that gnucash is not tying the purchases to the sales
> >>in order to compute the gain/loss.  I'm not _AS_ convinced that the
> >>gain/loss MUST imply a split to an income/expense account.
> >>
> >>-derek
> >>
> >>"Phillip Shelton" <shelton@usq.edu.au> writes:
> >>
> >>
> >>>Is it a bug then that the gain is currently un-balanceable?
> >>>
> >>_______________________________________________
> >>gnucash-devel mailing list
> >>gnucash-devel@lists.gnucash.org
> >>https://lists.gnucash.org/mailman/listinfo/gnucash-devel
> >>
> >
> >
> 
> 

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available