mini-ANNOUNCE: auto gain/loss scrubbing implemented

Derek Atkins warlord at MIT.EDU
Sun Apr 6 12:32:08 CDT 2003

linas at (Linas Vepstas) writes:

> Hi,
> I've unleashed automated 'lot scrubbing' aka automated determination
> of realized gains/losses in the experimental CVS branch.   
> How this works:
> -- search for 'trading accounts': these are accounts that have transactions
>    between different currencies/commodities.

I admit that I haven't looked at this, yet.  Is this "trading account"
a flag on an account?  Or is it a new account type?

I've come to realize that certain other types of accounts also would
do well with lot support.  For example, credit card accounts would do
well in order to keep track of which items have been paid and which
not.  Similarly, A/R and A/P (which is currently using lots) need the
same information.  Asset accounts could use it for Asset Tracking

> -- automaitcally assign splits to 'lots'.  A lot is opened by putting 
>    a split into it. All subsequent splits added to it must decrease
>    its 'amount' balance to zero.  When a lot hits zero balance, it is 
>    'closed'.  (see src/doc/lots.txt)

How would this work with "pre-payments" (or over-payments)?  Currently
I handle pre-payment as an open lot with a negative balance instead of
a positive balance.  During the payment processing, if a payment would
take an existing lot negative then it get's auto-split into a new lot
and so on (the one split becomes many splits).

Does your code do this, too?

> -- The value of the splits in a closed lot is totalled up.  This total
>    value is the 'realized gain/loss'.   If its not zero, a transaction is
>    added: one split goes into the lot, making its value zero, the other split
>    goes into a new 'realized gain/loss' account.   This implements the
>    'double balance' requirement discussed on this mailing list last
>    summer.

Cool!  Obviously this is never used if the commodities are the same,
but, still... Cool! :)


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

More information about the gnucash-devel mailing list