var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_ANNUALY
The numeric constant used to identify an annual period.
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_BI_ANNUALLY
The numeric constant used to identify a bi-annual period (twice every year).
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_BI_MONTHLY
The numeric constant used to identify a bi-monthly period (twice every month).
TODO: this period is not supported yet.
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_DAILY
The numeric constant used to identify a daily period.
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_FOUR_MONTHLY
The numeric constant used to identify a four-monthly period (once every four months).
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_FOUR_WEEKLY
The numeric constant used to identify a four-weekly period (once every four weeks).
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_MONTHLY
The numeric constant used to identify a monthly period.
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_NONE
The numeric constant used to identify that there is no period.
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_QUARTERLY
The numeric constant used to identify a quarterly period (once every three months).
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_TWO_MONTHLY
The numeric constant used to identify a two-monthly period (once every two months).
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_TWO_WEEKLY
The numeric constant used to identify a two-weekly period (once every two weeks).
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
PERIOD_WEEKLY
The numeric constant used to identify a weekly period.
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
STARTDAY_NORMAL
The numeric constant used to identify that the same start day should be used as the day of the month of the starting date of the event.
var c =plugins.amortization.newCalculation();c.addPayment(500,newDate(2005,1,28),null,plugins.amortization.AmortizationCalculation.PERIOD_DAILY,5,plugins.amortization.AmortizationCalculation.STARTDAY_NORMAL);var c2 =plugins.amortization.newCalculation();c2.addPayment(300,newDate(2006,11,24),newDate(2006,12,24),plugins.amortization.AmortizationCalculation.PERIOD_BI_MONTHLY,plugins.amortization.AmortizationCalculation.NUMBER_UNLIMITED,30);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
var c =plugins.amortization.newCalculation();c.addRateChange(r,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));c.addPayment(500,newDate(2005,1,28),null,12,5,31);
Returns the error that remains when solving for the unknown.
Please note that the error should be less or equal to 1E-8 - otherwise, the solveForUnknown value is incorrect.
var c =plugins.amortization.newCalculation();// sets the rate to -1 for unknown.c.addRateChange(-1,newDate(2005,0,1));c.addCompoundPeriodChange(12,newDate(2005,0,1));c.addLoan(2000,newDate(2005,0,1));var lastDate =null;var period =12;var number_count =5;var startday =31;c.addPayment(500,newDate(2005,1,28), lastDate, period,number_count, startday);// solves for the interest rate.c.solveForUnknown();// gets the interest rate and the error in the calculation.// which should be small (otherwise the calculation did// not converge for some reason.var r =c.getUnknown();var e =c.getError();
getEvents()
Returns all the amortization events - such as rate changes, loan events, payment events, compounding period changes.