Bug 103181: not-monthly repayment schedules not supported in Mortgage/Loan Druid
alessandro.basili at cern.ch
Mon Jan 13 09:10:00 EST 2014
I've just registered to this list since I'd like to fix this bug but I'd
like to first share some thoughts before hitting the ground running.
As of now it looks like only monthly repayment is 'supported' but this
is only by 'accident' to me. Looking at the code
(src/gnome/assistant-loan.c) it seems there's provision to support:
repayments. I'm not sure though why we want to keep an enumerated type
if the Mortgage/Loan Druid supports various combination of repayments.
We may argue that no one will have a repayment plan each 19 days... but
then I guess the Druid should not allow such flexibility.
Looking at the 'loan_apr_to_simple_formula' it seems that it deviates
from the definition reported in the documentation
the payment frequency is hard coded to '1' (referred to as PF in the
When, by chance, the frequency is 'monthly' the
loan_apr_to_simple_formula, combined with the switch in
'loan_get_ipmt_formula' (and its siblings for pmt and ppmt), provides
the correct ipmt formula, only because the parameter for compound_period
is '1' and the divisor for ipmt is '12'.
TODO: a) or b)
a) fix loan_apr_to_simple_formula' with one that takes into account
repayment periods and remove the second parameter in the g_string_printf
function called by loan_get_ipmt_formula, since it will be taken into
account by loan_apr_to_simple_formula.
b) leave unchanged loan_apr_to_simple_formula (even if wrong) and change
the compound rate parameter in each call to be fixed at 1, while
modifying the '12.0' to correspond to the actual compound frequency.
Considerations on the above mentioned proposals:
1) considering that there's no provision in the current Mortgage/Loan
Druid to provide a repayment frequency which is different from the
compound frequency, I guess there's no real point to keep a
repayment_period variable. On the other hand, a potential extension of
the Druid to provide such feature would profit of the possibility to
calculate the effective rate.
2) fix a) will require an interface change for
loan_apr_to_simple_formula since the repayment frequency will have to be
provided as a parameter.
I've not yet tested any of the above, but if some of you might have an
additional information I'm lacking of I would be happy to hear it before
I move on.
On a side note, I find it is a little confusing that the online
documentation is using some variable names like CF, PF and so on, while
the code seems to drift with a completely different set of variable names.
I guess some work needs to be done somewhere else since I haven't found
as of now where the compounding frequency is set in the druid.
BTW, I do not plan to be a developer or anything else, is just that I
need this feature to keep track of my mortgage, that's why I'd like to
press on with it.
Alessandro Basili - Electronic Engineer
CERN, CH-1211 Geneve 23, Switzerland
+41 22 767 4759
PGP Fingerprint DCBE 430E E93D 808B 45E6 7B8A F68D A276 565C 4450
PGP Public Key available at keys.gnugp.net
More information about the gnucash-devel