|
6 | 6 | <title>Monte Carlo Projection</title> |
7 | 7 | <link rel="stylesheet" href="styles.css"> |
8 | 8 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.0/chart.umd.min.js"></script> |
| 9 | + <script> |
| 10 | + function switchTab(method) { |
| 11 | + // Update tab buttons |
| 12 | + const tabButtons = document.querySelectorAll('.tab-button'); |
| 13 | + tabButtons.forEach(btn => btn.classList.remove('active')); |
| 14 | + event.target.classList.add('active'); |
| 15 | + |
| 16 | + // Update tab panels |
| 17 | + const percentageTab = document.getElementById('percentageTab'); |
| 18 | + const fixedTab = document.getElementById('fixedTab'); |
| 19 | + |
| 20 | + if (method === 'percentage') { |
| 21 | + percentageTab.style.display = 'block'; |
| 22 | + fixedTab.style.display = 'none'; |
| 23 | + document.getElementById('percentageRadio').checked = true; |
| 24 | + } else { |
| 25 | + percentageTab.style.display = 'none'; |
| 26 | + fixedTab.style.display = 'block'; |
| 27 | + document.getElementById('fixedRadio').checked = true; |
| 28 | + } |
| 29 | + } |
| 30 | + </script> |
9 | 31 | </head> |
10 | 32 | <body> |
11 | 33 | <div class="container"> |
12 | 34 | <h1>Monte Carlo Projection</h1> |
13 | 35 | <div class="subtitle">Investment Projection with 100,000 Simulations</div> |
14 | | - <div class="subtitle" style="font-size: 0.9em; margin-bottom: 20px;">Start Withdrawals After __ Years (e.g., Year 1 = end of first year)</div> |
15 | 36 |
|
16 | 37 | <div class="controls"> |
17 | | - <div class="control-group"> |
18 | | - <label for="initialInvestment">Initial Investment ($)</label> |
19 | | - <input type="text" id="initialInvestment" value="1,000,000"> |
20 | | - </div> |
21 | | - <div class="control-group"> |
22 | | - <label for="expectedReturn">Expected Annual Return (%)</label> |
23 | | - <input type="number" id="expectedReturn" value="17" step="0.1" min="0"> |
24 | | - </div> |
25 | | - <div class="control-group"> |
26 | | - <label for="volatility">Annual Volatility (σ) (%)</label> |
27 | | - <input type="number" id="volatility" value="20" step="0.1" min="0"> |
28 | | - </div> |
29 | | - <div class="control-group"> |
30 | | - <label for="yearsProjection">Years to Project</label> |
31 | | - <input type="number" id="yearsProjection" value="30" min="1" max="50"> |
32 | | - </div> |
33 | | - <div class="control-group"> |
34 | | - <label>Withdrawal Method</label> |
35 | | - <div style="display: flex; gap: 20px; margin-top: 5px;"> |
36 | | - <label style="display: flex; align-items: center; font-weight: normal;"> |
37 | | - <input type="radio" name="withdrawalMethod" value="percentage" checked style="margin-right: 5px;"> |
38 | | - Percentage of Portfolio |
39 | | - </label> |
40 | | - <label style="display: flex; align-items: center; font-weight: normal;"> |
41 | | - <input type="radio" name="withdrawalMethod" value="fixed" style="margin-right: 5px;"> |
42 | | - Fixed Amount with Inflation |
43 | | - </label> |
| 38 | + <!-- Investment Parameters Section --> |
| 39 | + <h3>Investment Parameters</h3> |
| 40 | + <div class="investment-params"> |
| 41 | + <div class="params-row"> |
| 42 | + <div class="control-group"> |
| 43 | + <label for="initialInvestment">Initial Investment ($)</label> |
| 44 | + <input type="text" id="initialInvestment" value="1,000,000"> |
| 45 | + </div> |
| 46 | + <div class="control-group"> |
| 47 | + <label for="expectedReturn">Expected Annual Return (%)</label> |
| 48 | + <input type="number" id="expectedReturn" value="17" step="0.1" min="0"> |
| 49 | + </div> |
| 50 | + <div class="control-group"> |
| 51 | + <label for="volatility">Annual Volatility (σ) (%)</label> |
| 52 | + <input type="number" id="volatility" value="20" step="0.1" min="0"> |
| 53 | + </div> |
| 54 | + </div> |
| 55 | + <div class="params-row" style="margin-top: 20px;"> |
| 56 | + <div class="control-group"> |
| 57 | + <label for="yearsProjection">Years to Project</label> |
| 58 | + <input type="number" id="yearsProjection" value="30" min="1" max="50"> |
| 59 | + </div> |
| 60 | + <div class="control-group"> |
| 61 | + <label for="withdrawalStartYear">Withdraw from the end of __ years</label> |
| 62 | + <input type="number" id="withdrawalStartYear" value="6" min="1" max="50" title="Enter the year when withdrawals should start. Year 1 means withdrawals start at the end of the first year."> |
| 63 | + <small style="color: #636e72; font-size: 0.8em; margin-top: 2px;">Year 1 = end of first year</small> |
| 64 | + </div> |
44 | 65 | </div> |
45 | 66 | </div> |
46 | | - <div class="control-group" id="withdrawalRateGroup"> |
47 | | - <label for="withdrawalRate">Annual Withdrawal Rate (%)</label> |
48 | | - <input type="number" id="withdrawalRate" value="3" step="0.1" min="0" max="100"> |
49 | | - </div> |
50 | | - <div class="control-group" id="fixedWithdrawalGroup" style="display: none;"> |
51 | | - <label for="fixedWithdrawalAmount">Starting Annual Withdrawal ($)</label> |
52 | | - <input type="text" id="fixedWithdrawalAmount" value="40,000"> |
53 | | - </div> |
54 | | - <div class="control-group" id="inflationRateGroup" style="display: none;"> |
55 | | - <label for="inflationRate">Annual Inflation Rate (%)</label> |
56 | | - <input type="number" id="inflationRate" value="2.5" step="0.1" min="0" max="20"> |
57 | | - </div> |
58 | | - <div class="control-group"> |
59 | | - <label for="withdrawalStartYear">Withdraw from the end of __ years</label> |
60 | | - <input type="number" id="withdrawalStartYear" value="6" min="1" max="50" title="Enter the year when withdrawals should start. Year 1 means withdrawals start at the end of the first year."> |
61 | | - <small style="color: #636e72; font-size: 0.8em; margin-top: 2px;">Year 1 = end of first year</small> |
| 67 | + |
| 68 | + <!-- Withdrawal Method Tabs --> |
| 69 | + <div class="withdrawal-section"> |
| 70 | + <h3>Withdrawal Method</h3> |
| 71 | + <div class="tabs"> |
| 72 | + <button class="tab-button active" onclick="switchTab('percentage')">Percentage of Portfolio</button> |
| 73 | + <button class="tab-button" onclick="switchTab('fixed')">Fixed Amount with Inflation</button> |
| 74 | + </div> |
| 75 | + |
| 76 | + <!-- Hidden radio buttons for maintaining compatibility --> |
| 77 | + <div style="display: none;"> |
| 78 | + <input type="radio" name="withdrawalMethod" value="percentage" id="percentageRadio" checked> |
| 79 | + <input type="radio" name="withdrawalMethod" value="fixed" id="fixedRadio"> |
| 80 | + </div> |
| 81 | + |
| 82 | + <div class="tab-content"> |
| 83 | + <div id="percentageTab" class="tab-panel active"> |
| 84 | + <div class="control-group"> |
| 85 | + <label for="withdrawalRate">Annual Withdrawal Rate (%)</label> |
| 86 | + <input type="number" id="withdrawalRate" value="3" step="0.1" min="0" max="100"> |
| 87 | + </div> |
| 88 | + </div> |
| 89 | + |
| 90 | + <div id="fixedTab" class="tab-panel" style="display: none;"> |
| 91 | + <div class="control-group"> |
| 92 | + <label for="fixedWithdrawalAmount">Starting Annual Withdrawal ($)</label> |
| 93 | + <input type="text" id="fixedWithdrawalAmount" value="40,000"> |
| 94 | + </div> |
| 95 | + <div class="control-group"> |
| 96 | + <label for="inflationRate">Annual Inflation Rate (%)</label> |
| 97 | + <input type="number" id="inflationRate" value="2.5" step="0.1" min="0" max="20"> |
| 98 | + </div> |
| 99 | + </div> |
| 100 | + </div> |
62 | 101 | </div> |
63 | 102 | </div> |
64 | 103 |
|
@@ -88,14 +127,6 @@ <h1>Monte Carlo Projection</h1> |
88 | 127 | <div class="stat-label">Worst Case (5th percentile)</div> |
89 | 128 | <div class="stat-value" id="worst">-</div> |
90 | 129 | </div> |
91 | | - <div class="stat-card"> |
92 | | - <div class="stat-label">Maximum Value</div> |
93 | | - <div class="stat-value" id="max">-</div> |
94 | | - </div> |
95 | | - <div class="stat-card"> |
96 | | - <div class="stat-label">Minimum Value</div> |
97 | | - <div class="stat-value" id="min">-</div> |
98 | | - </div> |
99 | 130 | <div class="stat-card"> |
100 | 131 | <div class="stat-label">Withdrawal Strategy</div> |
101 | 132 | <div class="stat-value" id="annualWithdrawalRate">-</div> |
|
0 commit comments