A Python-based personal finance simulation tool that helps project future wealth based on various income, expense, and investment parameters. It accounts for inflation, taxes, major life events (buying a home, having children), and market returns.
It is designed for a similar-age couple living in California, United States, currently renting their residence.
- Python 3.x
numpymatplotlib
Install dependencies using:
pip install -r requirements.txt- Open
config.py. - Edit the
CONFIGdictionary at the top of the file to match your personal financial situation and assumptions. - Run the script:
python wealth_simulator.py- The script will generate a plot showing your projected wealth over time, named `wealth_simulation.png' in this directory.
The CONFIG dictionary in config.py contains all the tunable parameters for the simulation:
start_age: Age at the start of the simulation.end_age: Age at which the simulation ends.retire_after_years: Number of years from start until retirement.current_wealth: Total initial liquid assets (cash + stocks).current_annual_salary: Current gross annual income.
annual_raise_percent: Expected annual salary increase percentage.annual_inflation_percent: The annual inflation rate applied to costs and tax brackets.stock_annual_return_percent: Expected annual return on stock investments.savings_annual_return_percent: Expected annual return on safe savings.
wealth_in_stock_percent: Percentage of portfolio allocated to stocks.wealth_in_saving_percent: Percentage of portfolio allocated to savings (should sum to 100 with stock %).
current_annual_cost: Base annual living expenses (excluding rent and specific items below).current_rent_monthly: Current monthly rent.
add_child_in_x_years: List of years from now when a child is born (e.g.,[1, 4]).child_duration_years: Number of years a child is a financial dependent.annual_child_cost: Annual cost per child (adjusted for inflation).
buy_x_dollar_home_in_y_years: List of tuples(Price, YearsFromNow)representing planned home purchases.annual_home_price_increase_percent: Expected annual appreciation of home value.property_tax_base_percent: Property tax rate as a percentage of assessed value.prop13_assessment_increase_cap: Cap on annual property tax assessment increase (relevant for California prop 13).mortgage_rate_percent: Annual mortgage interest rate.mortgage_term_years: Length of the mortgage in years.home_down_payment_percent: Down payment percentage.home_maintenance_percent: Annual maintenance cost as a % of home value.home_insurance_percent: Annual insurance cost as a % of home value.home_transaction_fee_percent: Costs associated with buying/selling property.
current_car_value: Current market value of your car.current_car_age: Age of your current car.annual_car_value_decrease_percent: List of tuples defining depreciation rates based on car age.buy_x_dollar_car_in_y_years: List of planned car purchases(Price, YearsFromNow).car_insurance_maintenance_annual: Annual cost for car insurance and maintenance.
retirement_medical_annual: Estimated annual out-of-pocket medical costs in retirement.capital_gains_tax_fed: Federal capital gains tax rate.capital_gains_tax_state: State capital gains tax rate.