mortgage-calculator-package
Version:
A simple, embeddable mortgage calculator that dynamically generates an interactive and styled calculator widget. It allows users to input mortgage amount, interest rate, amortization period, and payment frequency, and calculates the monthly payment based
37 lines (36 loc) • 2.06 kB
TypeScript
export interface MortgageInputs {
mortgageAmount: number;
grossAnnualIncome: number;
monthlyDebtPayments: number;
propertyTaxMonthly: number;
condoFees: number;
heatingCost: number;
interestRate: number;
amortizationYears: number;
isRentalIncomeEnabled: boolean;
rentalIncomeMonthly: number;
}
export interface CalculationResults {
monthlyMortgagePayment: number;
monthlyHomeExpenses: number;
monthlyIncome: number;
gdsRatio: number;
tdsRatio: number;
stressTestRate: number;
stressTestGDS: number;
stressTestTDS: number;
cashLeftGross: number;
totalMonthlyHousingCosts: number;
}
export declare function calculateMonthlyMortgagePayment(principal: number, annualRate: number, amortizationYears: number, compoundingFrequency?: string): number;
export declare function calculateGDSRatio(monthlyMortgagePayment: number, propertyTaxMonthly: number, heatingCost: number, condoFees: number, monthlyIncome: number, condoFeeInclusionRate?: number): number;
export declare function calculateTDSRatio(gdsAmount: number, monthlyDebtPayments: number, monthlyIncome: number): number;
export declare function getStressTestRate(contractRate: number): number;
export declare function calculateAllRatios(inputs: MortgageInputs, compoundingFrequency?: string, benchmarkStressRate?: number, condoFeeInclusionRate?: number, rentalIncomePortionRate?: number, stressTestType?: 'contract' | 'b20', rentalIncomeMethod?: 'add-back' | 'offset'): CalculationResults;
export declare function calculateIdealMortgageAmount(targetGdsRatio: number, inputs: MortgageInputs, compoundingFrequency?: string, condoFeeInclusionRate?: number, rentalIncomePortionRate?: number, stressTestType?: 'contract' | 'b20', rentalIncomeMethod?: 'add-back' | 'offset'): number;
export declare function getStressTestStatus(gdsRatio: number, tdsRatio: number): {
level: 'excellent' | 'good' | 'caution' | 'poor';
color: string;
message: string;
};
export declare function formatCurrencyDetailed(amount: any): string;