bank account interest
Derek Atkins
warlord at MIT.EDU
Fri Feb 11 11:38:20 EST 2005
Unfortunately this doesn't solve the "accountBalance(acct)" issue in order to
get the current balance of the account in question.
-derek
Quoting Josh Sled <jsled at asynchronous.org>:
> On Thu, 2005-02-10 at 22:38, Haichuan Yang wrote:
>
> > Is there any way for Gnucash to calculate the interest on a bank account,
> > and automatically enter the interest as an interest income? One will have
> > to enter the initial account balance, interest rate, compound method
> > (monthly) etc, to make this happen. Or does one have to enter manually the
> > interest say, each month?
>
> Scheduled Transactions can be used here. For the case of simple
> compounded interest, you can add the following function[s] to `fin.scm`:
>
> (define (futureValue a r n t)
> (* a (expt (+ 1 (/ r n)) (* n t))))
>
> (define (gnc:computeInterestIncrement amount interest periods i)
> (let ((thisVal (futureValue amount interest periods i))
> (prevVal (futureValue amount interest periods (- i 1))))
> (- thisVal prevVal)
> )
> )
>
> and use it in the scheduled transaction template-transaction;
> the credit-formula would then look like:
>
> computeInterestIncrement( 5000.00 : 0.03125 : 12 : i )
>
> If the formula was simple, then you could just enter it directly in the
> template transaction; unfortunately, the basic compounding-interest
> formula [1] involves exponentiation, which can't be handled in the
> current expression parser, so one must resort to defining it in
> scheme... also, note that you'll need to do the `i`th value minus the
> `i-1`th value in order to get the current increment. Luckily, the
> variable `i` is pre-bound to the current 1-based iteration count value,
> which is useful.
>
> I'll definitely move this function into the distribution going forward,
> and may -- eventually -- have this be a "stock" scheduled transaction
> template.
>
> [1]: a(1+(r_{n}/n))^(nt) as per
> http://www.riskglossary.com/articles/compounding.htm
>
> ...jsled
>
> --
> http://asynchronous.org/ - `a=jsled; b=asynchronous.org; echo ${a}@${b}`
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>
--
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 at MIT.EDU PGP key available
More information about the gnucash-user
mailing list