support simple daily interest

This commit is contained in:
Robert Dyer
2026-05-21 17:07:17 -05:00
parent f967435881
commit 526cb5fa3a
2 changed files with 10 additions and 2 deletions
+3 -1
View File
@@ -185,7 +185,9 @@ interest transaction on the 28th of the month, set the account note to
By default, interest is calculated using the 30/360 method where interest is
computed monthly using 30/360 (or 1/12) of the interest rate. If you need to
compute interest using the ACTUAL/ACTUAL method, set `interest:actual` in the
note. If you need to compute interest daily, set `interest:daily`.
note. If you need to compute interest daily, set `interest:daily`. For most
student loans, you probably want simple dailiy interest
`interest:daily-simple`.
You can optionally change the payee used for the interest transactions by
setting `INTEREST_PAYEE_NAME` in the `.env` file.
+7 -1
View File
@@ -49,6 +49,7 @@ function daysInYear(year) {
let numPeriods = 1
switch (kind) {
case 'daily':
case 'daily-simple':
period = daysInYear(interestTransactionDate.getFullYear());
numPeriods = daysPassed;
break;
@@ -60,7 +61,12 @@ function daysInYear(year) {
}
const balance = await getAccountBalance(account, interestTransactionDate);
const compoundedInterest = Math.round(balance * (Math.pow(1 + interestRate / period, numPeriods) - 1));
let compoundedInterest;
if (kind == 'daily-simple')
compoundedInterest = Math.round(balance * (interestRate / 365) * numPeriods);
else
compoundedInterest = Math.round(balance * (Math.pow(1 + interestRate / period, numPeriods) - 1));
interestRate = showPercent(interestRate);