Skip to content

Plan Configuration

The PlanConfig is the foundation of every simulation. It describes who you are, how you save, and how you plan to spend.

Basic Setup

from monteplan.config.schema import PlanConfig, AccountConfig

plan = PlanConfig(
    current_age=30,
    retirement_age=65,
    end_age=95,
    accounts=[
        AccountConfig(account_type="taxable", balance=50_000, annual_contribution=6_000),
        AccountConfig(account_type="traditional", balance=100_000, annual_contribution=20_000),
        AccountConfig(account_type="roth", balance=30_000, annual_contribution=7_000),
    ],
    monthly_income=8_000,
    monthly_spending=5_000,
)

Timeline Fields

Field Type Description
current_age int (18-100) Your current age
retirement_age int (18-100) Age when withdrawals begin. At or below current_age means the plan starts in retirement
end_age int (18-120) Planning horizon (must be greater than both current_age and retirement_age)
income_end_age int or None Age when contributions stop (defaults to retirement_age)

The engine simulates monthly from current_age to end_age. Before retirement_age, contributions are made. From retirement_age, spending is withdrawn from the portfolio. Contributions stop at income_end_age, which can be later than retirement_age (contributions and withdrawals then run side by side).

Plans That Start in Retirement

Set retirement_age at or below current_age for someone who has already retired. Withdrawals begin in the first simulated month and no contributions are made unless income_end_age is later than current_age. Any past retirement age gives the same result; the value is kept so callers can read when retirement began. PlanConfig.starts_retired reports the case, and SimulationResult.retirement_step gives the first retired month (0 here), so code does not need to compute (retirement_age - current_age) * 12, which is negative for these plans.

plan = PlanConfig(
    current_age=68,
    retirement_age=63,          # retired five years ago
    end_age=95,
    accounts=[
        AccountConfig(account_type="taxable", balance=200_000),
        AccountConfig(account_type="traditional", balance=600_000),
    ],
    monthly_spending=5_000,
    guaranteed_income=[
        # Already in payment: enter today's benefit
        GuaranteedIncomeStream(name="Social Security", monthly_amount=2_400, start_age=66),
    ],
)
assert plan.starts_retired

success_probability measures whether the portfolio stays above zero from the first retired month onward. It does not measure whether spending was met from all sources.

Account Types

Three account types with distinct tax treatment:

Type Tax on Contributions Tax on Growth Tax on Withdrawals
taxable Already taxed Capital gains tax None (basis already taxed)
traditional Tax-deductible Tax-deferred Ordinary income tax
roth Already taxed Tax-free Tax-free
AccountConfig(
    account_type="traditional",  # "taxable", "traditional", or "roth"
    balance=100_000,             # Starting balance
    annual_contribution=20_000,  # Annual contribution during working years
)

Income and Spending

  • monthly_income -- Pre-tax monthly income during working years
  • monthly_spending -- Desired monthly spending in retirement (today's dollars)
  • income_growth_rate -- Annual real income growth rate (default: 0.0)

Discrete Events

Model one-time financial events like home purchases, inheritances, or large medical expenses:

from monteplan.config.schema import DiscreteEvent

plan = PlanConfig(
    ...,
    discrete_events=[
        DiscreteEvent(age=35, amount=-50_000, description="Home down payment"),
        DiscreteEvent(age=55, amount=100_000, description="Inheritance"),
    ],
)

Positive amounts are inflows; negative amounts are outflows.

Guaranteed Income

Model Social Security, pensions, and annuities:

from monteplan.config.schema import GuaranteedIncomeStream

plan = PlanConfig(
    ...,
    guaranteed_income=[
        GuaranteedIncomeStream(
            name="Social Security",
            monthly_amount=2_500,
            start_age=67,
            cpi_indexed=True,    # Rises with simulated inflation (default)
            cola_rate=0.0,       # No growth above inflation
            end_age=None,        # Lifetime (default)
        ),
        GuaranteedIncomeStream(
            name="Pension",
            monthly_amount=1_500, # Nominal dollars at start_age
            start_age=65,
            cpi_indexed=False,   # Fixed nominal payment
            cola_rate=0.0,       # Nominal COLA; 0 = flat
        ),
    ],
)

A stream whose start_age is at or below current_age is already in payment. Enter today's payment as monthly_amount; its COLA accrues from the start of the simulation, not from start_age.

cola_rate is measured against the indexing basis. For an indexed stream it is growth above inflation, so Social Security takes cola_rate=0.0: setting it to the expected COLA (say 2%) would count inflation twice. For a non-indexed stream it is the nominal COLA written into the contract.

Guaranteed income offsets the amount that must be withdrawn from the portfolio, which raises success rates for retirees with Social Security or pensions. Streams are counted from retirement_age on; before that, saving is represented by account contributions.

Income Above Spending: Part-Time Work and Two-Earner Households

By default, guaranteed income that exceeds the spending need is not saved. Set surplus_income="invest" to deposit the excess into the first taxable account at the target allocation. This covers part-time work after leaving a main job, and a household where one person has retired while the other still earns.

plan = PlanConfig(
    current_age=66,
    retirement_age=63,
    end_age=95,
    accounts=[
        AccountConfig(account_type="taxable", balance=300_000),
        AccountConfig(account_type="traditional", balance=600_000),
    ],
    monthly_spending=7_000,
    guaranteed_income=[
        GuaranteedIncomeStream(name="Social Security", monthly_amount=2_400, start_age=64),
        # Take-home pay of the partner who still works, until they stop in three years
        GuaranteedIncomeStream(name="Work income", monthly_amount=5_500, start_age=66, end_age=69),
    ],
    surplus_income="invest",
)

Enter work income as take-home pay: streams are treated as after-tax offsets, so wages do not enter the tax brackets under tax_model="us_federal". "invest" requires a taxable account (a zero balance is fine), and a depleted portfolio is not refilled. To model 401(k) deferrals from the earner instead, reduce the stream by the deferral and keep a contribution on a traditional account running until income_end_age.

Spending Changes

spending_changes scales retirement spending from an age onward. Each entry multiplies whatever the spending policy computes, so it works with every policy. Steps compound. A change dated at or before current_age is ignored, because monthly_spending is today's spending and already reflects it.

from monteplan.config.schema import SpendingChange

plan = PlanConfig(
    # ...
    spending_changes=[
        SpendingChange(age=80, multiplier=0.75),  # one spouse dies; the survivor spends less
    ],
)

Quick-Start Templates

Use the built-in templates as starting points:

from monteplan.config.defaults import (
    default_plan,              # 30yo, retire 65, 3 accounts
    fire_plan,                 # 30yo, retire 45, aggressive saver
    coast_fire_plan,           # 35yo, retire 60, zero contributions
    conservative_retiree_plan, # 60yo, retire 65, Social Security at 67
)

See the API Reference for full field documentation.