Mortgage Formulas is a Coda Pack for mortgage loan originators and real estate investors. It bundles a layered domain library (mortgages, deals, properties, investors, analysis) with a wide pack surface: formatting helpers, creation factories, qualification and risk analysis, payment and amortization tooling, refinance comparisons, property projections, and sync tables for amortization schedules and investor deals.
- Purpose: Model mortgages, deals, and properties end to end inside Coda -- from raw inputs through amortization, qualification ratios, risk scoring, refinance analysis, and investor deal records.
- Inputs: Numeric loan parameters (amount, rate, term, program), borrower financial data (income, debts, credit score, down payment), property data (price, taxes, insurance), and JSON payloads that flow between creation formulas.
- Outputs: Currency- and percent-formatted strings, structured analysis objects (qualification, risk, refinance, ARM, HELOC), amortization rows, and deal records.
- Audience: Loan originators, real estate investors, and Coda builders constructing mortgage analysis docs and investment deal trackers.
- Account(s): Coda account with permission to install packs.
- Credentials: None.
- External setup: Not applicable. All calculations run locally; no third-party API is called.
- Limits: Domain calculations validate inputs through
ValidationErrors in the library layer (e.g. positive amounts, in-range LTV) and surface them as user-visible errors. Programs and occupancy types must match the values defined in the underlying library.
- Install the pack in a Coda doc.
- No authentication is required.
- Add the
AmortizationSchedulesand/orDealssync tables and supply the sync parameters described underTables. - Use the formulas (e.g.
CreateProperty,CreateInvestor,CreateMortgage,CreateDeal,DetailedAmortization,RefinanceAnalysis,RiskAssessment) directly in formulas, columns, or buttons. - Optionally apply the bundled column formats (
Currency,Percentage,Rate,MonthlyPayment,LoanAmount) to existing numeric columns.
This pack does not use external authentication.
- Method: None.
- Required scopes or permissions: Not applicable.
- Where credentials are entered in Coda: Not applicable.
| Name | Type | Description | Inputs | Returns |
|---|---|---|---|---|
FormatCurrency |
Formula | Formats a number as currency with optional decimals. | amount, decimals? |
Text |
FormatPercentage |
Formula | Formats a decimal as a percentage. | value, decimals? |
Text |
FormatRate |
Formula | Formats an interest rate decimal with precision. | rate |
Text |
FormatMonthlyPayment |
Formula | Formats a monthly payment as currency. | payment |
Text |
FormatLoanAmount |
Formula | Formats a loan amount as currency without cents. | amount |
Text |
CreateProperty |
Formula | Builds a Property domain object from raw fields. | id, street, city, state, zip, askingPrice, sqft, annualTax, annualInsurance, monthlyRent |
Property object |
CreateInvestor |
Formula | Builds an Investor domain object. | name, cash, annualIncome, taxRate, fixedExpense, variableExpense |
Investor object |
CreateMortgage |
Formula | Builds a Mortgage domain object. | loanAmount, interestRate, program |
Mortgage object |
CreateDeal |
Formula | Builds a Deal from investor + property + collateral JSON and loan terms. | investorJson, purchasePropertyJson, collateralPropertyJson, ltv, defaultInterestRate, program, managementFeePct, closingCost, occupancy |
Deal object |
AnalyzeCredit |
Formula | Returns a credit profile classification with contributing factors. | score |
Object |
RequiredReserves |
Formula | Computes required reserves (months) for a given occupancy and loan amount. | occupancy, loanAmount |
Number |
MaxLoanAmount |
Formula | Estimates a maximum loan amount from income, debts, credit score, and down payment. | monthlyIncome, monthlyDebts, creditScore, downPayment |
Number |
BreakEvenTimeline |
Formula | Generates a break-even timeline for closing costs vs monthly savings. | closingCosts, monthlySavings, months |
Array |
TimeValue |
Formula | Computes a time-value surrogate for a monthly benefit stream. | months, monthlyBenefit |
Number |
PaymentSchedule |
Formula | Compares payment frequencies (monthly, bi-weekly, etc.) and their impact. | loanAmount, interestRate, mortgageProgram |
Object |
ExtraPaymentAnalysis |
Formula | Analyzes the impact of recurring extra principal payments. | loanAmount, interestRate, mortgageProgram, extraMonthly |
Object |
AdvancedPaymentAnalysis |
Formula | Compares multiple payment strategies and their impact over time. | loanAmount, interestRate, term, … |
Object |
DetailedAmortization |
Formula | Generates a detailed amortization analysis with optional yearly milestones. | loanAmount, interestRate, mortgageProgram, yearlyMilestones |
Object |
InterestAnalysis |
Formula | Comprehensive interest cost breakdown for a mortgage. | loanAmount, interestRate, mortgageProgram |
Object |
ARMScenarioAnalysis |
Formula | Models ARM scenarios across initial rate, type, margin, and index. | loanAmount, initialRate, armType, margin, indexRate |
Object |
HELOCAnalysis |
Formula | Analyzes HELOC scenarios, draw period, and payments. | propertyValue, existingMortgageBalance, requestedLineAmount, helocRate, drawPeriodYears |
Object |
CalculateRatios |
Formula | Calculates the key lending ratios (LTV, DTI, front/back, etc.). | Loan and borrower numerics | Object |
QualificationAnalysis |
Formula | Comprehensive borrower qualification analysis. | Loan and borrower numerics | Object |
RiskAssessment |
Formula | Detailed risk assessment with stress testing across the deal. | Loan, borrower, property numerics | Object |
RefinanceAnalysis |
Formula | Comprehensive refinance analysis across multiple scenarios. | Existing and proposed loan terms, costs | Object |
RefinanceScenarioComparison |
Formula | Side-by-side comparison of refinance scenarios. | Scenario inputs | Array |
ClosingCostAnalysis |
Formula | Detailed analysis of refinance closing costs and fees. | Closing cost inputs | Object |
PropertyValueProjections |
Formula | Projects property value across years using appreciation and volatility assumptions. | currentValue, annualAppreciation, yearsToProject, marketVolatility |
Array |
CalculateInsuranceAndTaxes |
Formula | Estimates annual insurance and property taxes. | Property numerics | Object |
AmortizationSchedules-- produces a per-period amortization schedule from a loan amount, interest rate, and mortgage program. Sync parameters are required (loan amount, rate, program). The pack rebuilds the schedule from the library each sync; rows are keyed byscheduleId-period.Deals-- investment deal analysis records constructed from a JSON array ofDealInputobjects supplied as the sync parameterdealDataJson. Each row captures investor, property, mortgage, payments, occupancy, LTV, and APR derived through the domain layer.
Both tables are full-refresh; pass updated parameters and re-sync to regenerate output.
This pack registers five column formats backed by the formatting formulas. Apply them to a numeric column and the column value is rendered using the corresponding helper.
Currency-- renders a number viaFormatCurrency.Percentage-- renders a number viaFormatPercentage.Rate-- renders an interest-rate decimal viaFormatRate.MonthlyPayment-- renders a payment value viaFormatMonthlyPayment.LoanAmount-- renders a loan amount viaFormatLoanAmount.
- Call
CreateInvestor("Alice", 150000, 220000, 0.32, 4500, 800)and store the JSON result in a column. - Call
CreateProperty(...)for the purchase property and (optionally) a separate collateral property; store both as JSON. - Call
CreateDeal(investorJson, purchasePropertyJson, collateralPropertyJson, 0.8, 0.065, "Conventional30", 0.08, 7500, "PRIMARY")to assemble the deal. - Add the
Dealssync table withdealDataJsonset to a JSON array of deal inputs to surface the deals as rows. - Apply the
CurrencyandPercentagecolumn formats to numeric columns to keep the output consistently formatted, and runRiskAssessmentorRefinanceAnalysison the same inputs to layer in scenario analysis.
- The pack does not call any external rate, tax, or property data service; supply all market data yourself.
- Supported mortgage programs and occupancy types are limited to the values defined in
src/lib/mortgagesandsrc/lib/common/types. Unknown values surface asValidationErrors. RiskAssessment,RefinanceAnalysis, and similar analyses produce model output suitable for analysis and education, not for legal, regulatory, or production lending decisions.- JSON inputs to
CreateDealand theDealssync table must match the shape produced by the correspondingCreate*formulas; arbitrary objects will fail validation. - The bundled
Dealssync table generatesdealIds withDate.now(), so re-syncs produce new IDs and rows are not stable across runs.
| Problem | Likely cause | Resolution |
|---|---|---|
Invalid JSON input for investor or property |
A JSON parameter passed to CreateDeal (or another wrapper) is not parseable |
Verify the JSON string with ToJson() or by inspecting the source value |
Deal data must be a JSON array |
dealDataJson for the Deals sync table is not a JSON array |
Wrap your deal inputs in [ ... ] before passing them in |
Failed to parse deal data: ... |
The Deals sync parameter could not be parsed at all |
Check JSON quoting and escape characters in the formula input |
Deal N: <ValidationError message> |
The Nth deal failed library validation (negative amount, bad LTV, unknown program, etc.) | Fix the offending field on that specific deal input |
Invalid investor input / Invalid property input / Invalid deal input |
A required field was missing or out of range during creation | Verify all required fields and that numerics are positive and within documented ranges |
| Sync output empty or unchanged | Sync parameters were not supplied or the same parameters were resubmitted | Provide the required sync parameters (loan amount, rate, program for amortization; deal JSON for deals) and re-sync |
| Formatted columns show raw numbers | Column format not applied | Set the column format to Currency, Percentage, Rate, MonthlyPayment, or LoanAmount |
- Entry point:
src/pack/pack.ts(rootpack.tsis a shim). - Architecture: pure domain layer in
src/lib/(no Coda SDK dependency) with a thin pack layer insrc/pack/that wires the domain into formulas, sync tables, and column formats. Seedocs/ARCHITECTURE.md. - Build:
pnpm run build(runsbuild:libandbuild:packproject references). - Validate:
pnpm run coda:validate - Lint:
pnpm run lint - Typecheck:
pnpm run typecheck - Test:
pnpm run test(mocha) - Watch:
pnpm run watch(parallelbuild:watchfor the lib and pack layers) - Docs:
pnpm run generate:docsregenerates Markdown API docs intodocs/via TypeDoc (typedoc.json,tsconfig.typedoc.json). - Pre-commit: managed by Husky (
.husky/pre-commit), set up by thepreparescript. - Upload:
pnpm run coda:upload
- Source: https://github.com/ramiisaac/coda-pack-mortgage-formulas
- Issue tracking: https://github.com/ramiisaac/coda-pack-mortgage-formulas/issues
MIT. Copyright (c) 2026 Rami Isaac.
Author: Rami Isaac https://github.com/ramiisaac