accounting for stock trades

Derek Atkins warlord@MIT.EDU
03 Jan 2003 00:19:33 -0500


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

> Ok, so let me try this again.  Each Split has an Account,
> and Amount ( in the commodity of the Account ) and a Value,
> which may be in some other commodity needed to balance the transaction.

Well, every transaction has a "common currency" which is used to
balance the transaction.  All split values are in this common currency.
But yes, the rest is all correct.

> A Lot is a collection of Splits with the same Account.  In the case of
> a closed
> Lot where the Values of all Splits in the Lot are in the same
> commodity, the
> realized capital gain/loss on that Lot is the sum of the Values of the
> Splits in the Lot.

Correct.

> The unrealized capital gain/loss for an open Lot is the difference
> between the Value of the
> Splits in the Lot and the value at the current price of the Amount of
> Commodity in the
> Lot.

Well, this is certainly ONE way of computing it..

> So how do you handle half open Lots like:
> 
>            Lot
>            Amount        Value
> Split->    100           500
> Split->    -50           -500

There is no such thing as a "half" lot.  You have open lots and closed
lots.  In this case you have an open lot that has some realized gain
and some unrealized gain.

> how do you handle the realized/unrealized gain/loss for this.

 What this really means is that you need to treat these specially and
actually walk the splits and perform the computation.  In this case
you have a realized gain of 250, and an unrealized gain of 250
(assuming the price is still at 10).

> Also, how do you handle situations where the Commodity of the Value is
> different.
> For example:
> 
>            Lot
>            Amount        Value
> Split->    100 AMD       500 USD
> Split->    -100 AMD      -400 EUR
> 
> How do you handle the realized capital gain/loss for this Lot?

That's a good question.  You would somehow need to convert EUR to USD
(or vice-versa) in order to compute the actual gain/loss.

> Also, how do you handle the issue of an account with two Lots like this:
> 
>            Lot1
>            Amount        Value
> Split->     50 AMD        250 USD
> 
>            Lot2
>            Amount        Value
> Split->     50 AMD        500 USD
> 
> I then sell 80 AMD in a transaction where the AMDAccount spit is
> 
> Split->    80 AMD   1600 USD
> 
> How do I apply this single split to the above Lots?  Do I split the Splits?
> Combine the Lots?

You split the sale Split into two splits, one for each lot.

-derek

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