# Savings Interest Calculation and Posting

## Introduction

When creating a Savings Products, the user can define how interest posting (or compounding) and calculation will happen.

Mifos out-of-the-box currently supports two types of interest calculation; **Average Balance** and **Minimum Balance**.

The user may also choose from two types of *time period* for interest calculation; **Days** and **Months**

For interest posting, only **Months** are supported.

## Interest Posting

When a savings product is created, the user defines the frequency of interest posting of which only **Monthly** is supported in Mifos. Once at least one savings is open for a given savings product, a number of attributes of a savings product cannot be changed. The interest posting frequency and interest calculation frequency are two of this such attributes.

Interest posting always occurs on the **end of the month** and the exact dates are determined based on the **start of the fiscal year** (which is currently always Jan 1st in Mifos) and the chosen **interest posting frequency**.

For example every 3 months from Jan 1st would product interest posting dates of:

31st of March

30th of June

30th of September

31st of December

Interest posting is possible in Mifos from:

- An Overnight batch job named
**SavingsIntPostingTask**that detects savings accounts that are due for interest posting - When a Savings Account is closed and interest is due based on balance of savings account at closing.

Interest is only calculated and posted for the **last valid interest posting period** for a given savings account. As a result this means the following is also enforced:

- No adjustments of deposits or withdrawals are allowed if the transaction exists in a previous
**interest posting period**. To help enforce this we post interest even if the calculated interest is zero as this will result in the user being unable to adjust transactions prior to the interest posting. - No back-dated transactions are allowed if the transaction exists in a previous
**interest posting period**

## How Interest Is Calculated

When it becomes time to execute an interest posting for a given savings account we do the following:

- Retreive all
**End Of Day Detail**s for the account. (By this we mean that we find all deposits, withdrawals and interest that occured on a day) - Determine the range of applicable days for the
**interest posting period**e.g. 1st of Jan to 31st of March - Determine the
**interest calculation period**s that fall within this**interest posting period**. e.g. 1st of Jan to 31st of Jan, 1st of Feb to end of Feb etc - For each
**interest calculation period**we determine the applicable**interest calculation period detail**s. This will contain information such as account balance at start of period, and all applicable**End Of Day Detail**s for period. - For each
**interest calculation period**we also create an associated**Interest Calculation Period Calculator**which is solely responsible for calculating the interest earned/due for the given**interest calculation period**. The**Savings Interest Detail**s used by the calculator are taken directly from the savings product or if the savings products interest details have changed, its can use**historical interest detail**s. As a result, its is possible for adjust interest rates (or min interest required balance rule) and still calculate correctly the interest that was due in an**interest calculation period**that exists in the past.

## Interest Calculation Formula

I = P(r) only if P is greater than or equal to minimum balance required for interest calculation otherwise the interest (I) will be zero.

r = R/100 x D/F

where,

P = AvB/D or MB/D

I = Interest Amount

AvB = Total Average Balance for duration D

MB = Minimum Balance for duration D

D = Duration/Interval (Days) for which the interest is being calculated

F = Number of Days in Financial Year

P = Principal amount (initial amount) (Average/Minimum Balance)

R = Annual rate of interest (as a decimal) (defined during savings product creation)

r = Effective interest rate for the duration D

A = amount of money accumulated including interest

## Interest Calculation Examples

The purpose of these interest caluclation example is to describe by example how savings work in mifos. From reading through these, you should be able to understand

- How and when dates for interest calucation and posting are determined
- How the Average Balance algorithm works
- How the Minimum Balance algorithm works
- How and when interest is calculated for a given Interest Calculation Period
- How and when interest is posted to a savings account

see Interest Calculation For Average Balance By Example

see Interest Calculation For Minimum Balance By Example