risk-stress
Revalue linear positions under explicitly supplied asset-return scenarios, replay a dated historical window from the user's own price data, list the dated scenario library (Lehman 2008, COVID 2020, UK gilt and LDI 2022), find the most plausible shock that produces a target loss (reverse stress) under a supplied covariance, or scale a scenario to a target loss. Use for scenario loss and contribution analysis, "what happens if 2008 repeats", "what move loses us X", and "how far is this scenario from our loss limit". Not for options, credit migration or nonlinear margin calls.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- risk-stress
- description
- Revalue linear positions under explicitly supplied asset-return scenarios, replay a dated historical window from the user's own price data, list the dated scenario library (Lehman 2008, COVID 2020, UK gilt and LDI 2022), find the most plausible shock that produces a target loss (reverse stress) under a supplied covariance, or scale a scenario to a target loss. Use for scenario loss and contribution analysis, "what happens if 2008 repeats", "what move loses us X", and "how far is this scenario from our loss limit". Not for options, credit migration or nonlinear margin calls.
02 资源文件 4
- 参考文档reference.md9.0 KB
- 脚本scripts/check_artifact.py4.8 KB
- 参考文档workflows/replay.md1.4 KB
- 参考文档workflows/reverse-stress.md1.9 KB
03 SKILL.md 正文
Risk Stress
Five calculations, all for linear positions, all revalued by the same engine and all returned in the shared envelope (currency, as-of, source, data mode, input hash, degraded flag and reason, assumptions). Read the result, cite it, and do not re-derive numbers yourself.
| job | MCP tool | CLI |
|---|---|---|
| revalue supplied scenarios | risk_stress |
riskdesk stress --input PATH |
| replay a dated window from user prices | risk_stress_replay |
riskdesk replay --input PATH |
| list dated historical windows | risk_scenario_library |
riskdesk scenarios |
| reverse stress to a target loss | risk_reverse_stress |
riskdesk reverse-stress --input PATH |
| scale a scenario to a target loss | risk_scenario_scale |
riskdesk scale-scenario --input PATH |
If a tool is not listed by the server, say it is not available rather than computing the figure yourself.
Contracts
All requests carry the PortfolioRequest fields in
input contracts: as_of, currency,
source, data_mode, nav and linear positions.
- Stress: plus
scenarios, each naming exactly every portfolio asset, including an explicit zero when no change is intended. - Replay: plus
scenario_name,prices(asset to{ISO date: positive level}),start,end, optionalmeasure(end_over_start, the default, orworst_peak_to_trough) and optionalproxies(portfolio asset to the name of the series standing in for it). The prices are the user's own licensed data; Risk Desk ships none. - Library: no input. Returns windows with dates, reasons and sources, no returns.
- Reverse stress: plus
target_loss(positive),horizon_days,assets(each portfolio asset once, in covariance order),covariance(the user's covariance of simple returns over that horizon) and optionalfloors(asset to a lowest allowed shock, at least -1). - Scaling: plus
scenario(one scenario naming every portfolio asset) andtarget_loss.
What to report first
degradedanddegraded_reason, before any number. A replay that used a proxy is degraded and the reason names each proxy.- The headline: scenario
loss(positive is a loss, negative a gain) andstressed_nav, with currency and as-of. - For a replay, the window, the measure and any proxies. For reverse
stress, the
shocks,mahalanobis_distance,solutionandbinding_floors. For scaling,multiple. - Position
contributionswhen the user asks what drives the loss.
Sign conventions
Shocks are simple returns per 1.00: -0.10 is a 10% fall. P&L is positive for a profit; loss is minus P&L. No shock is below -1.
Rules you must follow when reporting
- A scenario, a replayed window, a reverse stress shock and a multiple are not event probabilities. Never present one as a forecast.
loss_exceedance_probability_if_normalholds only if returns were jointly normal with mean zero and the supplied covariance. Always say so in the same sentence as the number.- A worst peak-to-trough replay takes each asset's worst fall separately; the falls need not coincide and are gains for short positions. Do not call it the worst loss the book would have suffered in the window.
- Never fill a missing price, date or series with a guess or a zero. The tool refuses; ask the user for the series, or for an explicit proxy.
- The covariance, prices and floors are the user's inputs. Name their source; do not describe them as estimated by Risk Desk.
- Do not apply this model to option premium values, credit migration or nonlinear margin calls. Route derivative valuation to Option Desk pricing or a configured ORE project.
- Research software, not investment advice.
Going deeper
reference.md: every formula with its derivation, the sign table, the source and verbatim quotation for every library date, and what is refused.workflows/replay.md: replay a library window or the user's own window.workflows/reverse-stress.md: reverse stress and scenario scaling.scripts/check_artifact.py: run it on a saved result for a one line verdict. It rechecks loss signs, contribution sums, target loss, floors, the normal probability and replay levels with the standard library only.
04 同仓库更多 Skills
worktable-review-with-annotations
Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.
worktable-find-and-synthesize-context
Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.
worktable-create-or-update-docs
Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.
worktable-create-or-manage-records
Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.
worktable-create-or-manage-interactive-html
Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.
worktable-collaborate-threads
Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.