Dev Log: Building a Browser-Local Taiwan DCA Investment Calculator
2026-06-30
dev-logengineeringbuilding-in-publicfinance
This is the latest post in the LocalPapa Notes dev-log series. The subject this time is the Taiwan DCA Investment Calculator — a tool that lets you answer "how much will I have if I invest a fixed amount every month, for X years, at Y% return?" entirely in the browser.
Why we built this
Dollar-cost averaging (DCA) is the most common entry point into personal finance in Taiwan, especially as fractional-share and ETF periodic investing has grown massively in recent years. But most DCA calculators on the market have a few problems:
- They send your numbers to a server. You type your monthly investment and hit "calculate" — and that request leaves your device. That's an unnecessary privacy risk for financial information.
- They give one answer. Most tools let you set one return rate, but the real question is: "what's the difference between a conservative 5%, a steady 8%, and an aggressive 12% over time?"
- They ignore fees. Buying ETFs in Taiwan incurs brokerage fees (typically 0.1425%, often discounted). That small percentage chips away at principal over decades.
Our goal was clear: compute entirely locally, support multi-scenario comparison, and factor in fees.
Core math: month-by-month compound accumulation
The engine is a loop that runs once per month:
`` net monthly = monthly amount × (1 - fee rate) monthly rate = (1 + annual rate)^(1/12) - 1 end-of-month balance = previous balance × (1 + monthly rate) + net monthly ``
Converting the annual rate to a monthly rate lets the compounding roll monthly, which matches how ETF periodic investing actually works. The fee is deducted from each contribution at entry, not at the end — so the compounding effect of the cost is also captured.
Three scenarios, one table
The centrepiece of the tool is side-by-side multi-scenario comparison:
| Scenario | Annual return | Notes | |----------|--------------|-------| | Conservative | 5% | Below-average market estimate | | Balanced | 8% | Near Taiwan stock market long-run average | | Aggressive | 12% | Strong bull-market years |
All three columns update in sync. Users can see at a glance how dramatically a difference in return rate compounds over decades. This is where local computation shines — three full simulations run simultaneously, zero latency.
Canvas area chart: making compounding visible
Beyond the numbers, we added a Canvas area chart with years on the X-axis and amount on the Y-axis.
- Blue dashed line: cumulative amount invested (grows linearly)
- Green solid line + fill: total portfolio value (accelerates over time)
The green area between the two lines is the cumulative gain — and it widens as time goes on. The snowball effect of compounding is visible in a way no text can match. The chart is responsive and redraws automatically when the window resizes.
Year-by-year breakdown table
Below the chart, a year-by-year table shows for each year-end:
- Cumulative amount invested
- Total portfolio value
- Cumulative gain
- Return rate (%)
This gives users the full trajectory, not just the endpoint — which year does the gain exceed the principal? Where's the compound inflection point? It's all there.
FAQ design decisions
The FAQ section addresses questions real users actually ask:
- What return rate is realistic? Taiwan's market has averaged roughly 8–10% annually over the long term; ETFs can be benchmarked against their trailing 10-year CAGR, but past returns don't guarantee future ones.
- What fee rate should I use? The standard Taiwan brokerage fee is 0.1425%; many brokers offer discounts (e.g. 60%), putting the effective rate around 0.085%.
- Does this account for inflation? No. This tool computes nominal returns. Adding inflation adjustment complicates the model without meaningfully changing the core message: invest regularly.
Why fully local matters here
Your monthly investment amount is part of your financial picture. That number shouldn't leave your browser.
The entire simulation runs on your device. It works offline. No account, no login, no data passes through any server.
The same question, again
Like every other tool in this series, this one answers the same core question: can something that used to require trusting an online service be done entirely in the browser, instantly, and in a way that's actually more trustworthy?
For DCA simulation, the answer is: yes — and faster.
Want to follow the series? Bookmark LocalPapa Notes.