A Python-based financial analysis tool that models the Time Value of Money (TVM) to determine the optimal choice between a Lottery Lump Sum and a Lifetime Annuity.
The tool was inspred by the video Math Just Got Important from MindYourDecisions.
Real-Time Interactive Parameters:
- Lump Sum Amount ($500k - $2M)
- Weekly Annuity Payment ($50 - $10k)
- Investment Return Rate (0% - 15%)
- Inflation Rate (0% - 10%)
- Weekly Expenses ($0 - $10k)
- Expected Lifespan (20 - 120 years)
Four Dynamic Charts:
- Break-Even Analysis - Interest rate where lump sum equals annuity present value
- Net Worth Over Time - Wealth accumulation after expenses for both options
- Real Purchasing Power - Inflation-adjusted wealth trajectory
- Annual Cash Flow - Visual comparison of income vs expenses
Decision Support Metrics:
- Break-even interest rate calculation
- Final net worth comparison
- Optimal choice recommendation
- Financial advantage quantification
Using uv (recommended):
uv run app.pyUsing pip:
pip install -r requirements.txt
python app.py- Launch the application
- Adjust sliders in the left panel to modify parameters
- Charts update in real-time (300ms debounce after slider stops)
- Review decision metrics in the right panel
- Compare scenarios by adjusting different parameters
Validation Features:
- Warning banner appears when weekly payment ≤ expenses (unsustainable scenario)
- Weekly annuity payment slider turns red if payment ≤ expenses
- All panels resize proportionally when window is resized
numpy>=1.24.0,<2.0.0- Financial calculations and array handlingmatplotlib>=3.7.0,<4.0.0- Chart generationflet>=0.25.0,<1.0.0- Interactive desktop app UI
- Python 3.8+
- uv (recommended) or pip
The interest rate at which the present value of annuity payments equals the lump sum. If you can achieve returns above this rate, the lump sum is typically better.
Shows how your wealth grows over time considering:
- Investment returns
- Weekly expenses
- Payment structure (lump sum vs annuity)
Accounts for inflation to show the actual buying power of your money over time.
Based on your parameters, the analysis recommends which option maximizes your final net worth.