Banking day-count conventions and simple interest accrual:
| Convention | Day count | Year basis |
|---|---|---|
ACT_360 |
actual calendar days | 360 |
ACT_365 |
actual calendar days | 365 |
THIRTY_360 |
simplified 30/360 (each month 30 days) | 360 |
Interest = principal × annualRate × (dayCount / basis).
This is a learning / portfolio library, not a production accrual engine.
| Capability | Status |
|---|---|
| ACT/360, ACT/365, simplified 30/360 conventions | Implemented |
| Simple interest accrual over a date range | Implemented |
| Full ISDA/NASD 30/360 end-of-month matrix | Not included (simplified US-style month length) |
| Compounding interest | Not included |
| Business-day / holiday calendars | Not included |
| Persistence of accrual history | Not included (stateless calculator) |
flowchart LR
Req[Principal + rate + dates] --> Conv{Convention}
Conv --> A360[ACT/360]
Conv --> A365[ACT/365]
Conv --> T360[30/360]
A360 --> YF[Year fraction]
A365 --> YF
T360 --> YF
YF --> Int[Interest = P × r × YF]
For principal 100000, rate 12%, 2026-01-01 → 2026-07-01:
THIRTY_360→ 180 days → interest6000.00ACT_360→ 181 days → slightly higher than 6000ACT_365→ 181 / 365 year fraction
Class-level view of the main types and how they relate (fields, operations and dependencies).
classDiagram
direction TB
class InterestController {
<<controller>>
-service: InterestService
+accrue(request) AccrualResult
}
class InterestService {
<<service>>
+accrue(principal, rate, start, end, convention) AccrualResult
+days360(start, end) long
}
class AccrueRequest {
<<record>>
+principal: BigDecimal
+annualRate: BigDecimal
+startDate: LocalDate
+endDate: LocalDate
+convention: DayCount
}
class DayCount {
<<enumeration>>
ACT_360
ACT_365
THIRTY_360
}
class AccrualResult {
<<record>>
+convention: String
+dayCount: long
+yearFraction: BigDecimal
+interest: BigDecimal
+principal: BigDecimal
+annualRate: BigDecimal
}
InterestController --> InterestService
InterestController ..> AccrueRequest
AccrueRequest --> DayCount
InterestService ..> AccrualResult
./mvnw test
./mvnw spring-boot:runHTTP: http://localhost:8086
curl -s -X POST http://localhost:8086/api/interest/accrue \
-H "Content-Type: application/json" \
-d "{\"principal\":100000,\"annualRate\":0.12,\"startDate\":\"2026-01-01\",\"endDate\":\"2026-07-01\",\"convention\":\"THIRTY_360\"}"THIRTY_360 here follows a simplified US-style 30/360 month length (not the full NASD/ISDA end-of-month matrix).