Money-native · real, tested code

Calculate a Loan Amortization Schedule in Larzscript

Simple interest, compound interest, and a full monthly amortization schedule - with exact Money math, not float-drifted cents.

loan.amortize() returns one row per payment period (payment, interest, principal, remaining balance), the same breakdown a real loan statement shows.

larzscript pkg install loan

Code

import "loan" as loan

print(loan.simple_interest($1000.00, 0.05, 2))
print(loan.compound_interest($1000.00, 0.05, 12, 2))
let schedule = loan.amortize($10000.00, 0.06, 12)
print(len(schedule), "payments")
print(schedule[0])
Output
$100.00
$104.94
12 payments
{period: 1, payment: $860.66, interest: $50.00, principal: $810.66, balance: $9189.34}