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

Linas Vepstas linas@linas.org
Mon, 15 Apr 2002 20:57:10 -0500


On Mon, Apr 15, 2002 at 09:39:52PM -0400, Derek Atkins was heard to remark:
> David Hampton <hampton@employees.org> writes:
> 
> > On Mon, 2002-04-15 at 18:02, Linas Vepstas wrote:
> > > 
> > > However, any report that shows ROI or uses a FIFO to calculate
> > > profit/loss will have to look at old/closed books to figure out what 
> > > the original purchase price was.  That's the bad news.  The good news is
> > > I don't think we have any FIFO-based reports in gnucash yet.  :-)
> > 
> > A capital gains report for stock transactions is on my to-do list.  I
> > guess I'll wait for your book closing changes to go in before I start.
> 
> We might want to think about how such a report would work and interact
> with books.  It may require some changes to how stock accounts are
> actually copies across books.
> 
> Perhaps if a stock/mutual-fund account has a non-zero balance across a
> book change we might need extra information to maintain basis
> information.  Note that part of the reason to use books was to be able
> to reduce the file sizes -- if you need old books open to perform a
> cap-gains report, I think that fails the simplicity test.

Ooops, I guess I goofed twice, Derek is right as well.

> So, yes should probably really think about how this is going to work.

actually, I think I know how, because gnucash-1.2 had a cap-gains fifo
in it (which was lost somewhere along the way).

To make this work without having to load multiple books, one would have
to do several things:

1) save what kind of accounting method is used (FIFO, LIFO, or 
   one of the other IRS/tax-authority approved methods).

2) save enough of the fifo state to be able to compute the cap gains.
   This means saving not only the transactions for unsold stock,
   it also means saving the 'age' of the balance, and the price at which
   the balance was bought.

So if I bought 100 shares 5 years ago, and sold 50 two years ago, I need
to make note that I still have 50 (the balance) and that the balance is
5 years old (long-term cap gains rate).

If I bought 100 shares 5 years ago, 100 more 1 year ago, and sold 175
6 months ago, then my balance of 25 shares is only 1 years old (if using
the FIFO method) or 5 years old (if using the LIFO method).  Note
the difference in the the cap-gains rate that applies at tax time ...

Needless to say, storing extra stuff in the file format/database is 
a real pain in the butt.  SO the easy way out would be to automagially 
access old books, under the covers, whenever a report needed old data.  
Maybe not a performance win, but ... hey.

--linas


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

-- 
pub  1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas@linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984  3F54 64A9 9A82 0104 5933