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
+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);