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
|
||||
const down_payment = p.home_price * (p.down_pct / 100);
|
||||
const upfront_buy = down_payment + p.home_price * (p.closing_buy_pct / 100);
|
||||
const start_capital = p.start_capital || 0;
|
||||
|
||||
// --- state ---
|
||||
let balance = loan;
|
||||
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 cum_buy_cost = upfront_buy; // running cash spent on buying
|
||||
@@ -64,8 +67,9 @@ function run_simulation(p) {
|
||||
|
||||
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;
|
||||
const buyer_nw = home_value - selling_costs - balance + buyer_portfolio;
|
||||
|
||||
// --- rent side ---
|
||||
const renters_ins_m = p.renters_ins / 12;
|
||||
@@ -94,7 +98,7 @@ function run_simulation(p) {
|
||||
labels.push(`Jahr ${yr}`);
|
||||
buyer_nw_arr.push(Math.round(buyer_nw));
|
||||
// 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);
|
||||
renter_nw_arr.push(Math.round(portfolio - tax_on_gains));
|
||||
cum_buy_arr.push(Math.round(cum_buy_cost));
|
||||
|
||||
15
index.html
15
index.html
@@ -22,6 +22,13 @@
|
||||
|
||||
<!-- Shared inputs -->
|
||||
<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">
|
||||
<label for="years">Zeithorizont</label>
|
||||
<div class="slider-row">
|
||||
@@ -171,14 +178,6 @@
|
||||
<section class="card inputs-rent">
|
||||
<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">
|
||||
<label for="monthly_rent">Kaltmiete (monatlich)</label>
|
||||
<div class="num-unit euro-input">
|
||||
|
||||
Reference in New Issue
Block a user