YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
π― 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-plannerInstall dependencies:
pip install -r requirements.txtRun the application:
streamlit run retirement_planner.pyOpen 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.