Book clsoing [was: Re: Addition of HBCI support, Maturity of 1.7-branch, next stable release time frame?

Derek Atkins warlord@MIT.EDU
17 Apr 2002 14:12:38 -0400


"Michael T. Garrison Stuber" <garrisonstuber@bellsouth.net> writes:

> I'm confused by this.  I have some specific thoughts/questions below,
> but here is my basic concern:

Let's see if I can answer this (which would mean that I understand
the problem and Linas' proposed solution)...

> 	I'm thinking about this in terms of tracking stocks, and I'm
> taking you very seriously about lots being like accounts.  Let's
> assume that I have a stock account which I have purchase ten blocks of
> shares, each block being 500 shares.  (No, I don't have that kind of
> money, but stay with me here). I decide I want to sell (or give, or
> whatever) portions of my holding. Since I have excellent records I am
> choosing to identify sets of shares for tax purposes.  Specifically, I
> decide to give 200 shares from my third purchase to my local house of
> worship.  I need to determine my basis for the 200 shares, as well as
> tracking my basis in the remaining 4800 share position.  How does this
> work?
>
> 	Do I have two lots? One for shares that are actively part of
> my basis, and one for shares that have been liquidated?  If so, what
> do I do about the fact that a split can have only one lot?

No, you have 10 lots (one lot per purchase).  Basically, what the
'lots' mean is that each 'buy' transaction begins a lot, and each sell
transaction touches one or more lots (by perhaps having multiple
splits, one for each lot).

> 	Do I have a lot for every transaction?  (This only makes sense
> if lots aren't nearly as akin to accounts as I've assumed above).
> Does a lot have a "remaining balance" or a "units liquidated"
> independent of the sum of the constituent splits such that I can track
> what I've sold from this grouping of splits?

Not quite.

Every time you buy shares (widgets, inventory, whatever) you create a
new lot.  As you sell your shares, you tie your sales into specific
lots.  Due to the one-lot-per-Split limitation, if you sell from
multiple lots in one Transaction then you wind up requiring multiple
Splits in the Transaction, one Split per lot.

For example:

        Date    Desc    Lot     Buy     Sell    Price   Value           
        1/1/01  XCORP   187     500             $10.00  $5000.00
        2/1/01  XCORP   188     500             $12.00  $6000.00
        1/1/02  XCORP   187             250     $20.00  $5000.00
        1/1/02  XCORP   188             250     $20.00  $5000.00
        2/1/02  XCORP   187             200     $19.00  $3800.00

There are three Transacations, but four Splits into the XCORP Stock
Account.  What this means is that on 1/1/01 you buy 500 shares at $10;
on 2/1/01 you buy 500 shares at $12.  You have two lots, one for each
purchase.  Then on 1/1/02 you sell 500 shares at $20, selling 250 from
the first lot and 250 from the second lot.  Finally on 2/1/02 you sell
another 200 shares from lot 187 at $19.

The way a "lot" is like an Account is when you look at it from the LOT
View:

        Lot 187:
        Date    Buy     Sell    Price   Balance
        1/1/01  500             $10     500
        1/1/02          250     $20     250
        2/1/02          200     $19      50

        Lot 188:
        2/1/01  500             $12     500
        1/1/02          250     $20     250

As you can see, the lots are acting a lot like accounts in terms of
keeping a balance of the number of widgets.  When the balance reaches
zero, the lot has been completely sold and you no longer need to keep
the information around.  If the balance is non-zero, then you need to
keep the balance, purchase-date, and purchase-price around for the
lot-basis.

> Could/would these be created automatically on accounts which are set
> to track lots (assumes new account level flag)?  For example, I'd just
> assume that every stock purchase I make automatically have a lot
> associated with it, rather than having to go back and selectively
> build lots when I go to sell part of a security.  Or am I totally
> misapplying things?

I would envision that lots are created and tracked automagically on
accounts that are flagged to do so.  Or, perhaps, certain accounts would
track them by default (e.g. Stock accounts, A/R and A/P accounts, etc.)

> Is there a balance for the lot itself?  It's nice to know whether it's

Yes.  That's why it _looks_ like an account.  However the balance is
probably computed on the fly, rather than pre-computed.

> Would you expect lots to be interated through directly, or only
> through the GUID reference from a lists of splits?

Good question.

> For example, if I'm writing a report to determine my current basis in
> a stock position, for every purchase I'd like to take the price paid
> for each share, multiplied by the number of shares remaining in that
> lot and sum that together.  (Of course, this doesn't address the
> commision itself, but we won't worry about that right now).  This also
> assumes that for stock reporting all splits connected to a lot would
> have the same share price.

Commission is never taken into account in stock positions.  That
notwithstanding, yes, this is how I would envision it.  You would
iterate through each Split in the Account, find the "buy"
transactions, find the lot associated with that purchase, find the lot
balance, multiply for the cost-basis, and then keep a sum of the lot
balances and cost-basis calculations.

-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