Skip to content

Run a Monte Carlo simulation of a portfolio drawn down during retirement and visualize the results.

License

Notifications You must be signed in to change notification settings

pettijohn/PortfolioDrawdownMonteCarlo

Repository files navigation

Portfolio Drawdown Monte Carlo Simulation

Run a Monte Carlo simulation of a portfolio drawn down during retirement and visualize the results.

Live

This runs live at https://pettijohn.github.io/PortfolioDrawdownMonteCarlo/

Current status: Janky visualization on configurable inputs.

Backlog

  • Accept inputs!
  • Add basic "computing..." / "done" text !!! Background thread work?
  • Add dollars next to portfolio amounts
  • Add visualization, normalized to today's dollars
  • Add visualization, probability you didn't run out of money
  • Make the colors not horrible
  • Explain what you're looking at
  • Allow saving to localStorage
  • Allow sharing with query string parameters
  • Consider snowpack instead of deno bundle

Lessons Learned

  • To import a Node package, use a deno-friendly CDN, which does all the translation on the backend: import { Chart, ChartItem, registerables } from "https://esm.sh/[email protected]"; Don't include ?target=deno - the CDN returns the appropriate format depending on user agend (Deno for deno, es20xx for browsers).
  • To compile Deno with DOM compatibility, set the lib property in deno.json, and set deno.config to the same path in .vscode/settings.json to enable the linter to use the property. See Targeting Deno and the Browser
  • JSX is not automatically resolved, import React each time. (This partially worked, until I tried extends React.Component, then it couldn't find the name React.)
  • Deno bundle does not include source maps for attaching debugger - use this for development https://deno.land/x/deno_bundle
  • Versioning hell is real. Add ?pin=v74 to (pin the esh.sh build version)[https://esm.sh/#pin-the-build-version]
[ERROR]: Type 
'import("https://cdn.esm.sh/v71/[email protected]/types/index.esm.d.ts").ChartData<"line", number[], unknown>' 
is not assignable to type 
'import("https://cdn.esm.sh/v74/[email protected]/types/index.esm.d.ts").ChartData<"line", number[], unknown>'.
Types of property 'datasets' are incompatible.

About

Run a Monte Carlo simulation of a portfolio drawn down during retirement and visualize the results.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published