automatic interest traction

Josh Sled jsled at asynchronous.org
Thu Jul 5 10:53:00 EDT 2007


"Nikos Charonitakis" <nikosx at gmail.com> writes:
> i have a bond that receives money from interest once a year.
> My bank sends me a statement monthly that calculates interest in
> arrears, till the given date i receive the statement. These money are
> not cash yet.
> So any ideas how i can implement  this in gnucash?

I might be misunderstanding, but I'm not sure what you'd like to model
... if "these money are not cash yet", then it sounds like there's no
transaction to create, right?   You're neither receiving or sending money,
just being informed of the value?


In any case, if the bond is a fixed investment with a simple interest
schedule, and – more importantly – the transactions occur on a fixed schedule
(monthly, as you say), then you should be able to create a scheduled
transaction (SX) that uses a custom function to compute the correct value.

All scheduled transactions – when instances are being created – get an
'instance number': 1, 2, 3 ... this value is bound to the variable 'i' when
the credit and debit cells for the SX are evaluated.  These credit and debit
cells can contain formulæ which reference this value to compute whatever they
like; this is how the mortgage/loan druid works, for instance.  Note that the
*date* of the instance isn't provided, so you need to frame the calculation
in terms of a particular schedule (usually monthly), but most interest
computations are done this way anyways.

In this case, you'll need a slightly different function, however, but a
straightforward one.  You can get an idea of how the function should be
implemented by looking for the file 'fin.scm' in your gnucash installation.

Once you've determined the function you need, you can put it in
~/.gnucash/config.user, or even in that same fin.scm if you want to modify
your installed sources.  ~/.gnucash/config.user is a bit safer, though.

Then, you can create a SX where the template transaction uses the formula.
Note that the "gnc:" prefix is automagically added to whatever you enter in
the template transaction.  If you

    (define (gnc:simple_compounded_interest rate instance_num principal) ...)

in your .scm file, your template transaction should simply read:

    simple_compounded_interest(0.005:i:1000)

(or whatever).  You might want to use the mortgage/loan druid on a
fake/throw-away datafile just to get an idea of the types of scheduled
transactions that it creates.


That's not the clearest procedure in the world, so let me know if you have
any questions.  Or maybe I should just document the procedure with
screen shots and get it into the docs...  in any case, feedback welcome.

-- 
...jsled
http://asynchronous.org/ - a=jsled; b=asynchronous.org; echo ${a}@${b}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-user/attachments/20070705/f6799770/attachment.bin 


More information about the gnucash-user mailing list