Library to calculate Canadian mortgage payments
Canadian mortages are compounded semi-annually but payments are typically made monthly. This means that rates must be converted to accurately compute mortgage payments.
There are no prepayment options included in this calculator.
For a more flexible and complete mortgage calculator, visit the mortgage calculator from the Financial Consumer Agency of Canada.
use rust_decimal_macros::*;
fn main() {
let mortgage = canadian_mortgage::CanadianMortgage::new(
dec!(4.59),
25,
canadian_mortgage::PaymentFrequency::Monthly,
)
.unwrap();
println!("mortgage payment: {}", mortgage.payment(dec!(500000)).unwrap());
}
- Replicate all the other behaviour from a more complete calculator
- floating point and decimal representation
- Writing tests in Rust
- Mortgage math, specifically in the Canadian context
- Writing a Rust library, as opposed to a binary
- Web assembly widget