🎯 Retirement Planner with Monte Carlo Simulation
A comprehensive retirement planning tool built with Streamlit that combines deterministic projections with Monte Carlo risk analysis. Perfect for financial planning, portfolio optimization, and retirement strategy development.

✨ Features
📊 Portfolio Configuration
- Set initial portfolio value and retirement timeline
- Configure withdrawal amounts and inflation rates
- Tax rate optimization for capital gains and income
📈 Scenario Analysis
- Basecase Scenario: Your expected retirement path
- Stress Test Scenario: Crisis impact analysis
- Custom Crisis: Define your own market shock scenarios
- Historical crisis templates (Dot-Com, 2008, COVID-19)
🎯 Asset Allocation
- 7 asset classes: Equities, Bonds, REITs, Precious Metals, Crypto, Real Estate, Cash
- Default allocations: 50% Equities, 40% Bonds, 5% Precious Metals, 5% Cash
- Expected returns, income, and volatility parameters
- Mean reversion settings for advanced modeling
🎲 Monte Carlo Simulation
- Thousands of simulations with random market returns
- Interactive charts with confidence intervals (5th, 10th, 25th, 50th, 75th, 90th, 95th percentiles)
- Risk analysis with depletion probability
- Portfolio floor visualization (configurable minimum values)
- Logarithmic scaling for better visualization
📊 Advanced Analytics
- Correlation matrix configuration for realistic asset relationships
- Volatility modeling with historical data
- Mean reversion parameters for sophisticated modeling
- Mobile-responsive design for accessibility
🚀 Quick Start
Installation
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/retirement-planner.git
cd retirement-planner
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
streamlit run retirement_planner.py
-
Open your browser to http://localhost:8501
Usage Workflow
- 📊 Portfolio Configuration - Set your portfolio value and retirement timeline
- 📈 Scenarios - Configure your basecase and stress test scenarios
- 🎯 Asset Allocation - Set your portfolio weights and expected returns
- 📊 Expected Returns - Calculate future portfolio value based on expected returns (no variation)
- 🎲 Monte Carlo - Run simulations on thousands of potential paths into the future
Advanced Users: Experiment with parameters (correlations, volatilities, mean reversion) once familiar with the mechanics of this tool.
📱 Mobile-Friendly Design
- Responsive tabs with larger fonts and icons
- Touch-optimized interface for mobile devices
- Word wrapping for better readability
- Professional layout that works on all screen sizes
🎨 Visualization Features
Monte Carlo Charts
- Percentile lines showing confidence intervals
- Color-coded risk levels: Green (low risk) → Red (high risk)
- Interactive hover with detailed values
- Logarithmic scaling for exponential growth visualization
Risk Analysis
- 5th percentile focus: Your 1 in 20 worst-case scenario
- Depletion risk: Probability of running out of money
- Portfolio floor: Configurable minimum value display
- Stress testing: Crisis impact analysis
⚙️ Configuration Options
Monte Carlo Parameters
- Iterations: 100 to 50,000 simulations
- Portfolio floor: 0.1% to 50% of initial value
- Correlation matrix: Customizable asset relationships
Asset Classes
- Equities: Growth stocks and equity funds
- Bonds/CPF RA: Fixed income and CPF Retirement Account
- REITs: Real Estate Investment Trusts
- Precious Metals: Gold and other precious metals
- Crypto: Cryptocurrency investments
- Physical Real Estate: Property investments
- Cash/CPF OA: Cash and CPF Ordinary Account
📊 Sample Results
The tool provides comprehensive analysis including:
- Median portfolio values across time horizons
- Risk percentiles (5th, 25th, 50th, 75th, 95th)
- Depletion probabilities for different scenarios
- Crisis impact analysis with historical and custom scenarios
🛠️ Technical Details
Dependencies
- Streamlit: Web application framework
- NumPy: Numerical computations
- Pandas: Data manipulation
- Plotly: Interactive visualizations
Architecture
- Modular design with separate functions for calculations and visualization
- Session state management for user interactions
- Responsive CSS for mobile optimization
- Error handling with graceful fallbacks
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author
Created by Wolfgang Seidl via Claude.ai
🙏 Acknowledgments
- Built with Streamlit
- Visualization powered by Plotly
- Financial modeling concepts from modern portfolio theory
- Monte Carlo methods for risk analysis
📞 Support
For questions, issues, or feature requests, please open an issue on GitHub.
⚠️ Disclaimer: This tool is for educational and planning purposes only. It does not constitute financial advice. Always consult with a qualified financial advisor before making investment decisions.