Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Day Count Interest

CI

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).

Scope (honest)

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)

Architecture

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]
Loading

Worked example (same inputs)

For principal 100000, rate 12%, 2026-01-012026-07-01:

  • THIRTY_360 → 180 days → interest 6000.00
  • ACT_360 → 181 days → slightly higher than 6000
  • ACT_365 → 181 / 365 year fraction

Domain model

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
Loading

Quick start

./mvnw test
./mvnw spring-boot:run

HTTP: 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\"}"

Notes

THIRTY_360 here follows a simplified US-style 30/360 month length (not the full NASD/ISDA end-of-month matrix).

License

MIT

About

Banking day-count conventions (ACT/360, ACT/365, 30/360) and interest accrual calculator.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages