dfejza.com
All builds
Finance

Golden Handcuff Fixer 2000

Live· beta

Monte Carlo financial simulator for expats weighing stay-or-quit decisions. Compare 7 scenarios side-by-side (work, quit, part-time, Coast FIRE, geo-arbitrage) or model a full life timeline across phases. Features break-even analysis, probability of ruin tracking, and a Die With Zero calculator.

TypeScriptReactNext.jsRechartsMonte Carlo

AI-generated: this write-up was drafted by AI from the project's source code and may contain inaccuracies.

Golden Handcuff Fixer 2000 is a Monte Carlo financial simulator for the stay-or-quit decision: should you keep a well-compensated job, or walk away on existing savings? It runs portfolio simulations under randomized market returns and reports the probability of running out of money rather than a single optimistic projection. Two modes: Compare puts up to seven scenarios side by side, and Plan stitches them into one continuous life timeline. It is live and usable; the underlying model is deliberately simplified and the build is still beta.

Architecture

The simulation core is pure TypeScript with no server round-trip — everything runs in the browser. Annual market returns are drawn from a log-normal distribution: arithmetic mean and standard deviation (defaults: 10% / 18%) are converted to log-normal mu/sigma, and samples come from a Box-Muller normal transform. A single run walks the portfolio year by year — apply that year's return, add income minus inflation-adjusted expenses, deduct any down payment up front — and flags the run as ruined the first year net worth hits zero. runMonteCarlo repeats this monteCarloRuns times (config default 500, configurable up to 2,000), collects net worth at every year across all runs, and reports the 10th/25th/50th/75th/90th percentile trajectories plus probability of ruin and median/worst/best-case runway.

 generateReturns          simulateSingleRun
 (log-normal,             (year-by-year:
  Box-Muller)              return · income · burn · inflation)
        │                          │
        └──────────┬───────────────┘

            runMonteCarlo  (×N runs)


   percentiles (10/25/50/75/90) · P(ruin) · runway

Seven scenarios share the same engine, differing only in their cost and income functions: Work+Buy, Work+Rent, Quit+Buy, Quit+Rent, Part-Time (60% hours), Coast FIRE, and Geo-Arbitrage. The non-trivial ones are modeled honestly: part-time income holds living expenses fixed while gross income scales, so net savings drop disproportionately and can go negative; Coast FIRE sets income equal to total burn (net-zero savings, portfolio grows only on returns); quitting in Japan adds national pension and health-insurance costs that a salaried employee doesn't pay; geo-arbitrage applies a cost multiplier or pulls real cost-of-living data from the sibling Budget Calculator. Expenses inflate annually; workers' income inflates with raises, retirees' does not.

Phased simulation

Plan mode models a life as an ordered list of phases — e.g. work 5 years → part-time 3 years → quit 12 years. Rather than simulating each phase in isolation, simulatePhasedRun carries one portfolio continuously across phase boundaries, switching income, burn, and housing parameters as each phase begins while compounding inflation from absolute year zero. Life events (market crash, inheritance, recurring child/health expense, job loss) are keyed to absolute years and apply naturally across boundaries. The result is a single coherent trajectory instead of stitched-together segments.

Break-even and Die-With-Zero

Two derived calculators sit on top of the phased engine, both via binary search:

  • Break-even answers "how many more years must I work before quitting is safe?" It binary-searches the work-phase duration (~15 iterations, integer-year precision), splitting a fixed horizon into [work N years] → [quit remainder] and re-running the phased Monte Carlo at each step, converging on the minimum work years that keep probability of ruin under the threshold (default 5%). If even working the full horizon can't clear the bar, it reports no viable solution.
  • Die With Zero inverts the usual question. Instead of "will this burn rate last?", it binary-searches the maximum sustainable spend whose median final net worth lands closest to zero — roughly half the runs end with money left, half run slightly short. For multi-phase plans, calculatePhasedDWZ optimizes per-phase burn rates by coordinate descent: it binary-searches one phase's spend with the others held fixed, iterating up to five rounds until the total burn change settles under ~$500/year.

State (config, selected scenarios, burn rates, life events, phases, mode) persists to localStorage and encodes into a shareable URL. It is a model, not advice — real life adds variables it doesn't capture.