buyer also invests monthly savings when buying is cheaper than renting
This commit is contained in:
19
calc.js
19
calc.js
@@ -75,20 +75,21 @@ function run_simulation(p) {
|
||||
yr_upkeep += prop_tax_m + maint_m + insurance_m;
|
||||
cum_buy_cost += total_buy_m;
|
||||
|
||||
buyer_portfolio *= (1 + invest_r_m);
|
||||
const selling_costs = home_value * (p.closing_sell_pct / 100);
|
||||
const buyer_nw = home_value - selling_costs - balance + buyer_portfolio;
|
||||
|
||||
// --- rent side ---
|
||||
const renters_ins_m = p.renters_ins / 12;
|
||||
const total_rent_m = monthly_rent + renters_ins_m;
|
||||
yr_rent += monthly_rent;
|
||||
yr_rent += monthly_rent;
|
||||
yr_renters_ins += renters_ins_m;
|
||||
cum_rent_cost += total_rent_m;
|
||||
cum_rent_cost += total_rent_m;
|
||||
|
||||
// renter invests the difference if buying is more expensive
|
||||
const monthly_delta = Math.max(0, total_buy_m - total_rent_m);
|
||||
portfolio = portfolio * (1 + invest_r_m) + monthly_delta;
|
||||
// each side invests their monthly savings vs the other
|
||||
const rent_delta = Math.max(0, total_buy_m - total_rent_m);
|
||||
const buy_delta = Math.max(0, total_rent_m - total_buy_m);
|
||||
portfolio = portfolio * (1 + invest_r_m) + rent_delta;
|
||||
buyer_portfolio = buyer_portfolio * (1 + invest_r_m) + buy_delta;
|
||||
|
||||
const selling_costs = home_value * (p.closing_sell_pct / 100);
|
||||
const buyer_nw = home_value - selling_costs - balance + buyer_portfolio;
|
||||
|
||||
// apply capital gains tax on portfolio gains when we "cash out" at end
|
||||
// (we track gross portfolio, deduct tax in summary)
|
||||
|
||||
Reference in New Issue
Block a user