Developer Resource Center
Variable reference
Every variable you can use in conditions and formulas when writing a Blueprint.
Developer Resource Center
This page lists every variable you can use in a Blueprint written in ThriveScript. You can use them in withdrawal rule conditions, in action and amount formulas, in custom_variables formulas, in transfer rule amounts, in cash flow conditions and in compare_to expressions.
For what each section does, see the ThriveScript guide. For exactly what is allowed, see the grammar.
1. How to reference a variable
There are two ways to write a variable name.
| Style | Example | Use for |
|---|---|---|
| Flat name | portfolio_value, age_john |
Household-wide variables, and the flat per-person form where one exists. |
| Bracket notation | account_balance["John's 401k"], age["John"] |
Per-account and per-person variables. It keeps the original name, spaces included. |
Formulas are lists of variable, value and operator elements. They run from left to right with no operator precedence. For anything non-trivial, use a multi-step formula.
In a condition, compare_to can be a number, the name of another variable in quotes, or an expression of the form variable times a number, in quotes.
Each variable below is tagged:
- Static: set once at the start and never changes.
- Dynamic: recalculated every simulation year.
Four variables are updated after withdrawal rules run, so rules always see the previous year’s value: previous_withdrawal, previous_portfolio_return, previous_inflation and cumulative_inflation.
2. Time and phase
| Variable | Type | Meaning |
|---|---|---|
simulation_start_year |
Static | The calendar year the simulation begins, from retiree_profile. |
year |
Dynamic | The simulation year, counted from 1. It is 0 before the first year. Glide-path cycle_year keyframes and variance from_year and to_year use this count. |
calendar_year |
Dynamic | simulation_start_year plus year. |
phase |
Dynamic | "accumulation" while anyone is still working, otherwise "drawdown". Withdrawal rules only fire in drawdown. |
years_in_retirement |
Dynamic | Years since the last person retired. 0 during accumulation. |
3. People
These come from retiree_profile.people. {Name} stands for the person’s exact name.
| Variable | Type | How to write it | Meaning |
|---|---|---|---|
| age | Dynamic | age["{Name}"] or flat age_{name} in lowercase |
calendar_year minus birth_year. Both forms work. |
| retirement_year | Static | retirement_year["{Name}"] |
The person’s retirement year. Bracket notation only. |
| is_retired | Dynamic | is_retired["{Name}"] |
True once calendar_year reaches the person’s retirement year. Bracket notation only. |
There is no plain age. Use age_john or age["John"]. retirement_year and is_retired have no flat form.
4. Portfolio and account balances
| Variable | Type | Meaning |
|---|---|---|
portfolio_value |
Dynamic | The sum of the accounts in portfolio_scope, or of all accounts if you set no scope. Guardrails watch this number. |
portfolio_value_start |
Dynamic | portfolio_value at the start of the year, before returns and income. Use it as the denominator for guardrail rates. |
total_portfolio_value |
Dynamic | The sum of all accounts, whatever the scope. |
initial_portfolio_value |
Static | portfolio_value at the start. |
portfolio_peak_value |
Dynamic | The highest portfolio_value so far. |
portfolio_drawdown |
Dynamic | (peak - current) / peak. 0 at or above the peak. |
account_balance["{Account}"] or flat account_balance_{normalized} |
Dynamic | The current balance of a named account. The flat form is the name in lowercase with spaces turned into underscores. |
5. Withdrawals and spending
| Variable | Type | Meaning |
|---|---|---|
standard_of_living |
Static | Your yearly spending target in today’s dollars, from retiree_profile. It does not grow by itself. Inflation is applied where it is used. |
inflation_adjusted_sol |
Static | Starts equal to standard_of_living and is not updated each year. |
initial_withdrawal |
Static | Set to standard_of_living at the start. |
initial_withdrawal_rate |
Static | initial_withdrawal divided by initial_portfolio_value. The baseline for guardrail thresholds. |
previous_withdrawal |
Dynamic | Last year’s portfolio withdrawal. In year 1 it equals initial_withdrawal. |
withdrawal_amount |
Dynamic | This year’s portfolio withdrawal, after rules and the spending floor and ceiling. |
withdrawal_rate |
Dynamic | withdrawal_amount divided by portfolio_value at the end of the year. |
required_portfolio_withdrawal |
Dynamic | The default need: standard_of_living times inflation so far, minus active_income and cash_flow_income, never below 0. |
active_income |
Dynamic | Earned income from people still working. |
cash_flow_income |
Dynamic | Net income from cash flows this year, such as Social Security, pensions and bridge withdrawals. |
6. Returns and inflation
| Variable | Type | Meaning |
|---|---|---|
previous_portfolio_return |
Dynamic | Last year’s weighted portfolio return. |
portfolio_return |
Dynamic | This year’s weighted portfolio return, set after returns are applied. |
cumulative_inflation |
Dynamic | The running product of (1 + inflation) since the start. 1.0 at the start. |
previous_inflation |
Dynamic | Last year’s inflation rate. It is 0 in the first year. Use previous_withdrawal * (1 + previous_inflation) for a withdrawal that keeps last year’s raises and cuts. |
7. Required minimum distributions
| Variable | Type | Meaning |
|---|---|---|
rmd_amount |
Dynamic | The total required minimum distribution across all owners of tax_deferred accounts. |
rmd_amount["{Owner}"] |
Dynamic | One owner’s amount. Bracket notation. The flat form rmd_amount_{owner} also works. |
These variables only report an amount. They do not take any money out of an account. To withdraw the amount, you must write a withdrawal rule that withdraws rmd_amount["{Owner}"] from that owner’s tax_deferred account, usually with continue: true so it adds to your regular spending.
The amount is worked out for each owner, not each account. All of one owner’s tax_deferred accounts are added together, and one amount is calculated from that total, the owner’s age and their birth year. The amount is 0 before the owner’s start age. To trigger a rule, test whether rmd_amount["{Owner}"] is above 0. Do not test age["{Owner}"] in a rule condition. Per-person age variables are not available when rules are first read.
ThriveFI.app does not model taxes.
8. Your own variables
| Source | Type | Notes |
|---|---|---|
custom_variables.static.* |
Static | Any name you define. It can be a number, a person-and-age pair, a formula or steps. Computed statics resolve in dependency order at the start. |
custom_variables.dynamic.* |
Dynamic | Any name you define. Recalculated each year from top to bottom, so later variables can use earlier ones. |
The expose_as name of a survivor_benefit_start |
Static | A cash flow with a random survivor benefit saves its drawn transition year under this name. |
9. Settings you write that are not variables
Some features are settings in your Blueprint. You cannot use them by name in a formula. They change the variables above indirectly, through returns, balances and cash flow income.
| Setting | Where | Effect |
|---|---|---|
aum_fee |
job.asset_classes.{name} |
A yearly fee subtracted from that asset class’s return. It flows into account returns, portfolio_return and balances. |
return_variance, inflation_variance |
job.asset_classes.{name} |
Adds percentage points to returns or inflation, as a flat value or a range, between from_year and to_year. |
return_source: <asset class> |
job.asset_classes.{name} |
Reuses another asset class’s return series, with this class’s own fee and modifiers. |
variance_seed |
job |
Seeds the draws for range-form modifiers. |
inflation_modifier |
cash_flows[] |
Escalates a flow at inflation plus the modifier. |
absolute_inflation_rate |
cash_flows[] |
Escalates a flow at a fixed rate that ignores inflation. Cannot be combined with inflation_modifier. |
glide_path |
strategies.{name} |
An allocation that changes over time, instead of a fixed allocation. |
occurrence_probability and window |
one-time cash_flows[] |
A chance event that happens zero or one times, in a year drawn from the window. It shows up in cash_flow_income in the year it happens. |
To see every variable’s value each year, set job.debug: true. The results then include a snapshot of the variables for every year, which helps when you want to know why a rule fired.
10. Worked examples
A guardrail band that compares the live rate with a fixed baseline:
condition:
variable: "withdrawal_rate"
operator: ">"
compare_to: "initial_withdrawal_rate * 1.20"
A per-owner required distribution, routed to that owner’s account:
action:
withdrawal_amount:
formula:
- variable: 'rmd_amount["John"]'
Choosing a source account by last year’s market return:
condition:
variable: "previous_portfolio_return"
operator: "<"
compare_to: "crash_threshold"
Here crash_threshold is a static variable you defined.
An account balance inside a transfer amount:
amount:
- variable: "cash_reserve_target"
- operator: "-"
- variable: 'account_balance["Cash Reserve"]'Results are estimates from simulations, not predictions. They are not investment, tax or legal advice.