I am writing a Java application to calculate interest. The formulas for Simple, Compound, and Continuously Compounded interest use years to calculate the amount accumulated, but I want to use days so that my software updates more frequently. What formulas should I use? This is an Android project with JodaTime implemented for handling dates.
-
Strictly speaking, this question doesn't belong here. However, let me ask this: is the interest compounded daily or is it compounded yearly but you want to use a certain number of days? – casablanca Dec 12 '10 at 16:35
-
Sorry about the misplacement. But it's interest compounded yearly, and I want it to use a certain number of days. – Scooter Dec 12 '10 at 16:38
-
1In that case, the original compounding won't apply because it works on an yearly basis -- @Tryer's answer could work if you are okay with converting it to daily compounding. – casablanca Dec 12 '10 at 16:48
2 Answers
Compound Interest Multiple = [1+(Annual Interest in decimals/365)]^(number of days).
(The above assumes interest is applied or earned daily.)
Although not asked as a part of your question...if you want CONTINUOUS compounding,
Compound Interest Multiple = e^(Annual Interest in decimals*Time (as a fraction of years))
(The above assumes interest is applied or earned continuously.)

- 3,580
- 1
- 26
- 49
-
-
If your annual interest rate is 8% and you compound for 700 days, the multiple is [1+0.08/365]^700 – Tryer Dec 12 '10 at 16:39
-
This assumes there is 365 days a year. This may not be true (at banks we usually assume 250, 252 or 256 depending on market conventions, or the fact that 256 = 16^2, but for interest rates, it can be 360 or 365). – Alexandre C. Dec 12 '10 at 18:37
-
@Alexandre True...But then again, interest calculation depends on context. Staying in the finance domain itself, the bond market (US Treasury) does assume calender days (either 360 or 365 or in some cases actual number of days) and not working/business days. An examples is calculation of accrued interest (in the context of calculating the "dirty" price of a bond from its "clean" price). Even a bank CD (when broken before its maturity) earns interest in actuals, if I am not wrong. – Tryer Dec 12 '10 at 18:46
-
The problem you have is that 1+x/365 as an approximation. e.g. (1+10%/365)^365 is 1.11 so 10% has turned into 11%. ;) What you need is (1+x)^days/365. In which case 365 days is 1 + x. – Peter Lawrey Dec 12 '10 at 18:48
-
@Peter My answer assumes interest is compounded daily. If not, then your approach seems correct. I use the term "seems" because, in practice, interest is usually quoted and compounded on an annual basis and when it needs to be calculated for non-integral multiples of a year, one usually LINEARLY interpolates between the two bracketing integers. Example is the calculation of accrued interest on a bond. Your formula is not linear. Do you know of an application where your formula is used in order to calculate in-between years interest? – Tryer Dec 12 '10 at 18:56
-
@Tyler, your second example is exponential (non linear). for small values of x: (1+x)^n ~= e^n – Peter Lawrey Dec 12 '10 at 20:25
In finance, interests follow a yield curve, so the interest waries base don the number of days in the period. e.g. http://en.wikipedia.org/wiki/Yield_curve you can see even for US rates (for the US dollar) it varies from day to day. http://www.treasury.gov/resource-center/data-chart-center/interest-rates/Pages/TextView.aspx?data=yield
Another compilcation is that there are different ways to calculate daily rates. One way to calculate rates is to assume there are 365 days in the year (even for leap years), but 360 is more common, some bonds only count working days. In short it all depends on the currency.

- 525,659
- 79
- 751
- 1,130
-
I doubt OP is willing to strip market data to compute a yield curve. – Alexandre C. Dec 12 '10 at 18:38