An open toolbox for credit modeling in Python
Credkit provides elegant, type-safe primitives for building credit models that typically force teams to reach for Excel. From consumer loans to portfolio analytics, credkit offers domain-driven tools designed for precision and composability.
Built for consumer lending (mortgages, auto loans, personal loans) with cash flow modeling, amortization schedules, and present value calculations.
Currently focused on USD-denominated consumer loan products in the US market.
See EXAMPLES.md for more comprehensive examples of all features.
- Day count conventions: ACT/365, ACT/360, ACT/ACT, 30/360, and more
- Periods: Time spans with natural syntax ("30Y", "6M", "90D")
- Payment frequencies: Annual, monthly, bi-weekly, etc.
- Business day calendars: Holiday-aware date adjustments
- Money: Currency-aware amounts with Decimal precision
- Interest rates: APR with multiple compounding conventions
- Spreads: Basis point adjustments (e.g., "Prime + 250 bps")
- Cash flows: Individual payment representation with present value
- Schedules: Collections with filtering, aggregation, and NPV
- Discount curves: Flat and zero curves with interpolation
- Loan types: Mortgages, auto loans, personal loans
- Amortization: Level payment, level principal, interest-only, bullet
- Schedules: Generate complete payment schedules with principal/interest breakdown
- Integration: Full end-to-end from loan creation to NPV calculation
- Immutable by default: All core types are frozen dataclasses
- Decimal precision: No floating-point errors in financial calculations
- Type safety: Full type hints with py.typed marker
- Composable: Build complex models from simple primitives
- Tested: 148 passing tests with comprehensive coverage
- EXAMPLES.md: Comprehensive code examples for all modules
- Python 3.13+
- No runtime dependencies (uses only standard library)
Contributions welcome! This project follows:
- Domain-driven design with immutable primitives
- Comprehensive testing
AGPL-3.0
For commercial licensing options, contact the author
148 passing tests covering temporal operations, money arithmetic, cash flow modeling, discount curves, loan instruments, and end-to-end loan valuation.