portfolio_risk
Answer both 'how bad did it get' and 'is it really diversified' for a built-in model portfolio, a canonical strategy or your own portfolio. Drawdowns: the deepest peak-to-trough episodes with months to trough and recovery, Ulcer index, longest time underwater, monthly VaR/CVaR 95, worst month and year, and returns in 2008, 2020 and 2022. Diversification: each holding's share of the risk next to its share of the money (60/40 is about 60% of the money and 93% of the risk), the number of independent bets over the full window, the last 10 years and the 36 months to Feb 2009 and Dec 2022, co-movement groups, near-duplicate pairs and the equal-risk weights. Correlations: the holdings' correlation matrix. Pass exactly one of template (e.g. classic-60-40, all-weather), strategy (e.g. faber-trend-timing) or assets (your own allocation, including nested portfolios, rotations and strategies as holdings via sleeve, with optional rebalance and overlay); list_portfolios shows valid ids. sections limits the output. Ids are precomputed from the monthly refresh (instant); assets are computed live, with independent bets over the full window (and the last 10 years for plain tickers); the 2008 and 2022 windows are computed for built-in portfolios only. Read-only. For headline CAGR/Sharpe use analyze_portfolio; for calendar returns use portfolio_returns.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | Optional display name for a custom `assets` portfolio. Default "Custom portfolio". | |
| assets | No | Your own allocation instead of an id, computed live (drawdowns, risk share, bets and correlations of your own mix). Same format as analyze_portfolio: plain tickers and nested portfolios, rotations or strategies via `sleeve`. Weights in percent, summing to ~100. | |
| overlay | No | Optional portfolio-level trend-filter overlay applied to the WHOLE book: hold the entire portfolio only while its own level is above its N-month moving average, otherwise cash. Composition is monthly (a 10-month filter ≈ the classic 200-day one). | |
| episodes | No | How many of the deepest drawdown episodes to list (1-8). Default 5. | |
| sections | No | Which parts to return: drawdowns, diversification, correlations. Default: all three. | |
| strategy | No | Canonical rule-based strategy id, e.g. 'faber-trend-timing'. A strategy is one rule-based line, so its diversification section is reported as not applicable. | |
| template | No | Built-in model portfolio id, e.g. 'classic-60-40', 'all-weather', 'golden-butterfly'. list_portfolios shows all 19. | |
| rebalance | No | Rebalancing cadence for custom portfolios (templates use their own). | yearly |