Portfolio¶
Presets, characteristics, and glide paths.
create_portfolio_assumptions¶
Create portfolio capital market assumptions.
| Parameter | Type | Default | Description |
|---|---|---|---|
preset |
string | "standard" |
Preset to use: 'standard', 'conservative', or 'optimistic' |
stocks_return |
float | null | Override stock expected annual return (e.g., 0.07 = 7%) |
stocks_volatility |
float | null | Override stock annual volatility (e.g., 0.15 = 15%) |
bonds_return |
float | null | Override bond expected annual return (e.g., 0.04 = 4%) |
bonds_volatility |
float | null | Override bond annual volatility (e.g., 0.06 = 6%) |
cash_return |
float | null | Override cash expected annual return (e.g., 0.02 = 2%) |
cash_volatility |
float | null | Override cash annual volatility (e.g., 0.01 = 1%) |
Returns: base_preset, and assumptions.
calculate_portfolio_characteristics¶
Calculate expected return and volatility for a portfolio allocation.
| Parameter | Type | Default | Description |
|---|---|---|---|
stocks_pct |
int | required | Stock allocation percentage (0-100) |
bonds_pct |
int | required | Bond allocation percentage (0-100) |
cash_pct |
int | required | Cash allocation percentage (0-100) |
assumption_preset |
string | "standard" |
Assumptions preset: 'standard', 'conservative', or 'optimistic' |
stocks_return |
float | null | Override stock expected return (e.g., 0.07 = 7%) |
stocks_volatility |
float | null | Override stock volatility (e.g., 0.15 = 15%) |
bonds_return |
float | null | Override bond expected return (e.g., 0.04 = 4%) |
bonds_volatility |
float | null | Override bond volatility (e.g., 0.06 = 6%) |
cash_return |
float | null | Override cash expected return (e.g., 0.02 = 2%) |
cash_volatility |
float | null | Override cash volatility (e.g., 0.01 = 1%) |
Returns expected annual return and volatility for the portfolio.
generate_glide_path¶
Generate a glide path transitioning between two allocations over time.
| Parameter | Type | Default | Description |
|---|---|---|---|
start_stocks_pct |
int | required | Starting stock allocation (0-100). When age_based=True, this is the young/pre-glide allocation. |
start_bonds_pct |
int | required | Starting bond allocation (0-100). When age_based=True, this is the young/pre-glide allocation. |
start_cash_pct |
int | required | Starting cash allocation (0-100). When age_based=True, this is the young/pre-glide allocation. |
end_stocks_pct |
int | required | Ending stock allocation (0-100). When age_based=True, this is the retirement allocation. |
end_bonds_pct |
int | required | Ending bond allocation (0-100). When age_based=True, this is the retirement allocation. |
end_cash_pct |
int | required | Ending cash allocation (0-100). When age_based=True, this is the retirement allocation. |
num_years |
int | 30 |
Number of years for the glide path (ignored when age_based=True) |
sample_interval_years |
int | 5 |
Show allocation every N years (default: 5) |
age_based |
bool | false |
If True, use age-based 3-phase glide path instead of linear transition |
current_age |
int | null | Person's current age (required if age_based=True) |
death_age |
int | null | Assumed age at death (default: 95, used if age_based=True) |
retirement_age |
int | null | Retirement age (default: 67, used if age_based=True) |
glide_start_age |
int | null | Age when allocation starts shifting (default: 47, used if age_based=True) |
Returns the allocation timeline with samples at regular intervals.