A suite of open-source financial calculators and simulation engines designed for long-term planning. This project provides the core mathematical logic for the web tools available at indexlongrun.com.
Our philosophy is built on three core principles:
- Transparency: Financial planning shouldn't be a black box. All our calculations, assumptions, and methodologies are open for you to inspect, critique, and verify.
- Privacy-First: We believe your financial data is yours alone. Our engines are designed to perform calculations without requiring personal data, and our web tools will never store your information without your explicit consent.
- Evidence-Based: Our models are grounded in established financial theories and a long-term, passive investing approach.
This monorepo contains the logic for multiple financial tools. Each primary tool is organized in its own directory:
financial-tools/
├── notebooks/ # Jupyter notebooks to quickly run the logic
├── retirement_simulator/ # Monte Carlo simulator for traditional retirement
├── shared_logic/ # Common functions (e.g., inflation) used by multiple tools
└── ... (more tools coming soon)
The core tool is a Monte Carlo simulator designed to assess the viability of long-term retirement plans.
To account for market uncertainty, the simulator runs thousands of randomized trials. This approach provides a range of possible outcomes and calculates the probability of success for your financial plan.
Portfolio values are projected using a Geometric Brownian Motion model:
Where:
-
$P_{t+1}$ : Portfolio value at the end of the year -
$P_t$ : Portfolio value at the start of the year (after contributions/withdrawals) -
$r$ : Expected Annual Return -
$\sigma$ : Annual Volatility (standard deviation) -
$Z$ : Random variable drawn from the standard normal distribution
For a detailed breakdown, see the README in /retirement_simulator/.
Each tool in this repository can be run independently. The code is designed to be clear and easy to understand.
- Python 3.x
- NumPy
pip install numpy- Navigate to the tool's directory:
cd retirement_simulator - Run the primary engine script:
python engine.py
Each engine script includes example parameters that you can modify to test different scenarios.