Calculate the grant elements for loans with limited info
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Loan Calculator

Using the calculator

Currently deployed at

Making a request

GET or POST data to /calculate to find the grant element of a loan, for example:

Your request must include:

  • value
  • maturity (in years)

Your request may include:

  • grace_period (in years, defaults to 0)

  • interest_rate (provide as a decimal, eg 0.05 for 5%, or defaults to 5% )

  • discount_rate (provide as a decimal, eg 0.1 for 10%, or defaults to 10%)

  • year (for providing default discount rates or interest rates not implemented)

  • repayments_per_year (defaults to 2, ie, semi-annual)

  • disbursement_span_in_years (defaults to 1, ie, lump sum)

  • disbursements_per_year (defaults to 1, ie, lump sum)

  • include_lifecycle (pass "true" to see the calculated repayment steps )

The Response

The JSON response includes the grant element value and grant element percent, as well as all values used in calculating the grant element.

If you request the loan lifecycle, it is also returned.

Grant Element

Grant element (value) = (Present value of future disbursements) - (Present value of future repayments) Grant element (percent) = Grant element value / (Present value of future disbursements)

Face value of the loan = declared amount Present value of the loan = Present value of future disbursements

Present value of future disbursements

You have to know how the loan is disbursed:

  • Lump sum, all at once?
  • Equal payments of frequency x over y years?

Lump sum

Present value of future disbursement = Face value

Equal payments of frequency x over y years

Present value of future repayments

You have to know how the loan is repaid:

  • When:

    • Grace period of x years?
    • Maturity of x years?
  • How:

    • Lump sum, all at once
    • Equal Principal Payments
  • Discount Rate:

Equal Principal Payments

This means you pay off an equal share of the original amount plus accrued interest for that period.