Creating a loan bid
For each loan request the bank receives, a loan bid can be issued.
To issue a loan bid:
- Navigate to the loan reuqest
- Click on the tab
loans
Issuing a loan bid occurs in two stages:
- First an agent creates and configures the loan either from a Loan Template or by creating a custom one. Once the agent confirms the loan proposal, this is submitted for approval. The agent can
REVOKE
a loan bid whilst its still pending.
- The loan bid is then sent for approval to a person with higher role privilages. The agent receives a notification and can either
ACCEPT
orREJECT
the proposal.
Configuring the loan bid
The agent can either utilise a Loan Template
which the bank has preconfigured or start from scratch with a custom configuration.
Loan Bid Configuration
The following are the parameters that can be tweaked in the loan configuration
Parameter | Description |
---|---|
Currency | The currency of the current loan request |
Frequency | The frequency to use. By default this is monthly |
Days In Month | The mortgage calculator needs to establish the days in the month. Preset values are ACTUAL and 30 . A custom value can be used. |
Days In Year | The mortgage calculate needs to establish the days in the year. Preset values are ACTUAL or 360 . The agent can specify a custom value. |
Setting the loan bid
Once the configuration is in place, the agent can define a set of PERIODS
. Each period will take into consideration the frequency
established in the period and use that to calculate the duration value.
There are three types of PERIODS
Period | Description |
---|---|
Interest Only | The mortgage calculator will use the Interest Rate established to calculate the interest only period |
Fixed Rate | In a fixed rate period, the bank establishes a period of time the interest rate is applied. |
Variable Rate | In a variable rate period, the bank establishes a period of time the interest rate is applied on top of the bank base rate. Note for the purposes of the loan calculation this is worked as fixed with the interest rate calculated as interest rate + base rate |
Setting charges
TODO: Coming Soon
Setting collaterals
TODO: Coming Soon
How the Mortgage Repayment Schedule Engine works
- The Engine is initialised with the configuration supplied as well as the periods & charges. Variables are used to keep track of the current date, remaining principal, paid interest, and month and year counters.
- It iterates over each period in the periods array, which represents the different periods of the mortgage.
- For each period, it calculates the actual interest rate based on the period type and base rate. The interest rate is divided by 100 to convert it to a decimal.
- Inside the period iteration, it iterates over each month in the duration of the period.
- For each month, it increments the current date by one month and updates the month and year counters.
- The Months Repayent is than calculated using the following parameters:
currentMonth
: the month to calculate the payment forloanPeriodType
: the type of the loan period (e.g. 'INTEREST_ONLY')interestRate
: the interest rateremainingPrincipal
: the remaining principal amount of the loanmonths
: the number of monthscurrentDate
: the current date
The function first checks if the loanPeriodType is INTEREST_ONLY
. If it is, the function returns the monthly payment as the product of the remainingPrincipal and the interest rate calculated using the calculateInterestRate method.
If the loanPeriodType is not INTEREST_ONLY
, the function calculates the monthly interest rate using the calculateInterestRate method and then uses the PMT function to calculate the monthly payment.
The PMT function is a financial function that calculates the payment for a loan based on the interest rate, number of periods, and present value. The syntax for the PMT function is:
PMT(rate, nper, pv, [fv], [type])
Where:
rate
is the interest rate per periodnper
is the number of periodspv
is the present value (the initial amount of the loan)fv
is the future value (the amount left over after the loan is paid off)type
is the type of payment (0 for end of period, 1 for beginning of period)
In this case, the PMT function is used with the following arguments:
rate
: the monthly interest rate calculated using the calculateInterestRate method nper
: the number of months pv
: the negative of the remainingPrincipal (since the PMT function expects the present value to be negative)
The result of the PMT function is then returned as the monthly payment.
Note that the PMT function is not actually executed as an Excel formula, but rather as a JavaScript implementation of the same formula.
- It calculates the interest amount for the current month by getting the product of the remaining principal with the calculated interest rate. The calculated interest rate utilises the configuration to deteremin the
days in month
anddays in year
and are used:
It calculates the principal repayment amount. For
INTEREST ONLY
periods this is zero whilst in the other periods this is calculcated with the difference between the repayment amount and the interest amountIf the period type is not 'INTEREST ONLY', it adjusts the remaining principal by subtracting the interest amount from the repayment amount.
For loan configuration where days in month is set to
ACTUAL
, the repayment amount is averaged across the year to get it groups the schedule by year using the reduce function and filters out any empty objects. It adjusts the repayment amount for each year to make it equal across the schedule.