startkapital as shared input, buy invests remainder after Eigenkapital
This commit is contained in:
10
calc.js
10
calc.js
@@ -26,11 +26,14 @@ function run_simulation(p) {
|
|||||||
// upfront costs for buyer
|
// upfront costs for buyer
|
||||||
const down_payment = p.home_price * (p.down_pct / 100);
|
const down_payment = p.home_price * (p.down_pct / 100);
|
||||||
const upfront_buy = down_payment + p.home_price * (p.closing_buy_pct / 100);
|
const upfront_buy = down_payment + p.home_price * (p.closing_buy_pct / 100);
|
||||||
|
const start_capital = p.start_capital || 0;
|
||||||
|
|
||||||
// --- state ---
|
// --- state ---
|
||||||
let balance = loan;
|
let balance = loan;
|
||||||
let home_value = p.home_price;
|
let home_value = p.home_price;
|
||||||
let portfolio = upfront_buy + (p.start_capital || 0); // renter invests this lump sum + any extra savings
|
// renter invests all startkapital; buyer spends upfront_buy and invests the remainder
|
||||||
|
let portfolio = start_capital;
|
||||||
|
let buyer_portfolio = Math.max(0, start_capital - upfront_buy);
|
||||||
let monthly_rent = p.monthly_rent;
|
let monthly_rent = p.monthly_rent;
|
||||||
|
|
||||||
let cum_buy_cost = upfront_buy; // running cash spent on buying
|
let cum_buy_cost = upfront_buy; // running cash spent on buying
|
||||||
@@ -64,8 +67,9 @@ function run_simulation(p) {
|
|||||||
|
|
||||||
cum_buy_cost += total_buy_m;
|
cum_buy_cost += total_buy_m;
|
||||||
|
|
||||||
|
buyer_portfolio *= (1 + invest_r_m);
|
||||||
const selling_costs = home_value * (p.closing_sell_pct / 100);
|
const selling_costs = home_value * (p.closing_sell_pct / 100);
|
||||||
const buyer_nw = home_value - selling_costs - balance;
|
const buyer_nw = home_value - selling_costs - balance + buyer_portfolio;
|
||||||
|
|
||||||
// --- rent side ---
|
// --- rent side ---
|
||||||
const renters_ins_m = p.renters_ins / 12;
|
const renters_ins_m = p.renters_ins / 12;
|
||||||
@@ -94,7 +98,7 @@ function run_simulation(p) {
|
|||||||
labels.push(`Jahr ${yr}`);
|
labels.push(`Jahr ${yr}`);
|
||||||
buyer_nw_arr.push(Math.round(buyer_nw));
|
buyer_nw_arr.push(Math.round(buyer_nw));
|
||||||
// apply Abgeltungssteuer on portfolio gains at cashout
|
// apply Abgeltungssteuer on portfolio gains at cashout
|
||||||
const portfolio_gains = portfolio - upfront_buy;
|
const portfolio_gains = portfolio - start_capital;
|
||||||
const tax_on_gains = Math.max(0, portfolio_gains) * (p.tax_rate / 100);
|
const tax_on_gains = Math.max(0, portfolio_gains) * (p.tax_rate / 100);
|
||||||
renter_nw_arr.push(Math.round(portfolio - tax_on_gains));
|
renter_nw_arr.push(Math.round(portfolio - tax_on_gains));
|
||||||
cum_buy_arr.push(Math.round(cum_buy_cost));
|
cum_buy_arr.push(Math.round(cum_buy_cost));
|
||||||
|
|||||||
15
index.html
15
index.html
@@ -22,6 +22,13 @@
|
|||||||
|
|
||||||
<!-- Shared inputs -->
|
<!-- Shared inputs -->
|
||||||
<section class="inputs-shared card">
|
<section class="inputs-shared card">
|
||||||
|
<div class="input-group">
|
||||||
|
<label for="start_capital">Startkapital <span class="hint">(verfügbares Eigenkapital gesamt)</span></label>
|
||||||
|
<div class="num-unit euro-input">
|
||||||
|
<span class="unit prefix">€</span>
|
||||||
|
<input type="number" id="start_capital" min="0" max="10000000" step="1000" value="100000" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<label for="years">Zeithorizont</label>
|
<label for="years">Zeithorizont</label>
|
||||||
<div class="slider-row">
|
<div class="slider-row">
|
||||||
@@ -171,14 +178,6 @@
|
|||||||
<section class="card inputs-rent">
|
<section class="card inputs-rent">
|
||||||
<h2 class="col-header rent-header">Mieten</h2>
|
<h2 class="col-header rent-header">Mieten</h2>
|
||||||
|
|
||||||
<div class="input-group">
|
|
||||||
<label for="start_capital">Startkapital <span class="hint">(zusätzl. Ersparnisse)</span></label>
|
|
||||||
<div class="num-unit euro-input">
|
|
||||||
<span class="unit prefix">€</span>
|
|
||||||
<input type="number" id="start_capital" min="0" max="10000000" step="1000" value="0" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<label for="monthly_rent">Kaltmiete (monatlich)</label>
|
<label for="monthly_rent">Kaltmiete (monatlich)</label>
|
||||||
<div class="num-unit euro-input">
|
<div class="num-unit euro-input">
|
||||||
|
|||||||
Reference in New Issue
Block a user