Documentation

Understand how Torvani models the rent vs. buy decision, or integrate our analysis engine into your own application via the REST API.

API Endpoints

POST/v1/calculate
POST/v1/simulate
GET/v1/locations/:zip
GET/v1/market-data/:metro
POST/v1/signup
POST/v1/login
GET/v1/account
POST/v1/checkout

Authentication

All API requests require an API key passed via the X-API-Key header.

curl https://torvani-api.smarttechinvest.com/v1/locations/90210 \
  -H "X-API-Key: tor_your_api_key_here"

User Cost of Housing Model

Based on the Poterba (1984) framework, we compute the annual user cost of ownership as:

Buy Cost = Mortgage + Property Tax + Insurance + Maintenance + HOA - Tax Deductions - Principal Buildup - Appreciation

This is compared against the annual rent cost (monthly rent x 12 + renter's insurance) escalated at the local BLS CPI Shelter rate. The model captures the full economic cost of both options, not just the monthly payment.

Monte Carlo Simulation

Rather than a single point estimate, Torvani runs 10,000 simulated scenarios for each analysis. Each scenario draws from distributions calibrated to historical data:

  • Home appreciation -- metro-specific distribution from FHFA HPI historical data
  • Rent escalation -- distribution from BLS CPI Shelter component
  • Maintenance costs -- fat-tailed distribution accounting for major repairs
  • Investment returns -- historical S&P 500 return distribution for opportunity cost

The result is a complete cost distribution with expected cost, median, 5th percentile (best case), and 95th percentile (worst case) -- so you can make decisions based on your risk tolerance.

NPV Breakeven Analysis

We compute a discounted cash flow comparison of cumulative renting vs. buying costs over 1-30 year horizons. The breakeven point is the exact month where cumulative buying costs (including opportunity cost of the down payment) become lower than cumulative renting costs.

Using the Monte Carlo output, we report breakeven at multiple confidence thresholds: 50% (more likely than not), 75% (likely), and 90% (highly likely). This tells you not just when buying might be cheaper, but how confident you can be in that conclusion.

Tax Impact Modeling

Our tax model includes mortgage interest deduction, the $10,000 SALT cap, standard vs. itemized deduction comparison based on your filing status and income, and the $250K/$500K capital gains exclusion at sale. Many calculators assume you will itemize -- we compute whether itemizing actually saves you money vs. the standard deduction.

Sensitivity Analysis

Tornado charts show which input variable has the largest impact on your rent vs. buy answer. Typically the biggest drivers are time horizon, home appreciation rate, and mortgage rate -- but it varies by market and scenario.

Each variable is tested at +/- one standard deviation from its expected value while holding all others constant. This shows you where uncertainty matters most and where small changes can flip the recommendation.