risk-counterparty
Calculate Basel SA-CCR exposure at default for one derivative netting set (CRE52), or summarise a simulated exposure profile such as an ORE netting-set exposure report into peak PFE, EPE, Effective EE and Effective EPE (CRE50, CRE53). Use for regulatory counterparty exposure measures. Not for CVA or other valuation adjustments (use risk-xva), not for portfolio credit loss (use risk-credit), and not for capital requirements or risk weights.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- risk-counterparty
- description
- Calculate Basel SA-CCR exposure at default for one derivative netting set (CRE52), or summarise a simulated exposure profile such as an ORE netting-set exposure report into peak PFE, EPE, Effective EE and Effective EPE (CRE50, CRE53). Use for regulatory counterparty exposure measures. Not for CVA or other valuation adjustments (use risk-xva), not for portfolio credit loss (use risk-credit), and not for capital requirements or risk weights.
02 资源文件 4
- 参考文档reference.md7.6 KB
- 脚本scripts/check_artifact.py3.5 KB
- 参考文档workflows/exposure-profile.md1.2 KB
- 参考文档workflows/saccr-ead.md1.8 KB
03 SKILL.md 正文
Risk Counterparty
Two tools, both read-only and deterministic.
risk_saccrtakes one netting set of trades and returns its SA-CCR exposure at default with every intermediate figure: replacement cost, multiplier, add-on per asset class and hedging set, and per trade the adjusted notional, supervisory duration, maturity factor, supervisory delta and effective notional. CLI:riskdesk saccr --input PATH.risk_exposure_profiletakes the rows of one ORE netting-set exposure report (column names exactly as ORE writes them) and returns peak PFE, EPE, Effective EE at every date and Effective EPE over the first year. CLI:riskdesk exposure-profile --input PATH.
Examples: examples/counterparty_saccr.json (the Basel CRE99 example 5 portfolio, EAD 1,879)
and examples/counterparty_profile.json.
The contract, in short
Every request carries as_of, currency (three capital letters), source and data_mode
(synthetic or user-licensed). All amounts are in that one currency. Times are in years from
as_of. Unknown fields and non-finite numbers are refused.
An SA-CCR trade has id, asset_class (interest_rate, fx, credit, equity,
commodity), positive notional, signed market_value (value to the bank), maturity (M),
and position (long or short in the primary risk factor; for an option, long means bought).
What else it needs depends on the class:
| class | hedging_set | reference | start, end | other |
|---|---|---|---|---|
| interest_rate | currency, eg USD |
none | required (S, E) | |
| fx | pair, eg EUR/USD |
none | none | |
| credit | none | entity or index name | required (S, E) | rating AAA to CCC, or IG or SG with index: true |
| equity | none | entity or index name | none | index: true for an index |
| commodity | energy, metals, agricultural or other |
commodity type | none | electricity: true for electricity |
notional means the trade notional for interest rate and credit, the foreign leg converted to
the request currency for fx, and price times units for equity and commodity. An option adds
option (call or put), underlying_price, strike, exercise (T, years) and, for a
negative-rate interest rate option only, shift (lambda).
The netting set adds netting_set, collateral (C, haircut value of net collateral held,
positive when held) and, when margined is true, threshold, minimum_transfer_amount, nica,
remargining_period_business_days and mpor_business_days. The MPOR must be at least nine
business days plus the remargining period.
An exposure profile has rows, at least two, the first at Time 0, times strictly increasing,
one netting set, each with non-null, non-negative BaselEE and PFE.
Never invent a trade term, a rating, a market value, a collateral amount or an exposure row. If one is missing, ask for that value only.
What to report first
degradedanddegraded_reason, before any number.- For SA-CCR:
eadwith the currency, thenreplacement_cost,multiplier,pfeandaddon_by_asset_class. For a margined set, say whethercap_appliedis true. - For a profile:
effective_epeandepewithaveraging_horizon_years, thenpeak_pfewith its time. - The
source,as_ofandinput_sha256, so the figure can be traced.
Sign conventions
Exposure is a positive amount the bank could lose on counterparty default. market_value and
collateral are signed from the bank's side: positive value is owed to the bank, positive
collateral is held by the bank. Replacement cost is floored at zero. A negative netting-set
value or excess collateral lowers the multiplier, never the replacement cost below zero. ORE's
BaselEE and PFE are positive exposures; ORE's ENE keeps ORE's own negative sign and is
not used.
What not to claim
- SA-CCR EAD is a regulatory exposure measure, not a loss forecast, a price or a capital requirement. No risk weight is applied.
- This is one bilateral netting set. Basis and volatility hedging sets, CDO tranches, central counterparty MPOR floors, the 20-day MPOR cases and multiple netting sets or margin agreements are not modelled. Say so if the user's book needs them.
- FX and equity add-ons are partially verified: their constants are checked against CRE52.72,
but the Basel Framework publishes no worked FX or equity example, so they are checked by hand
arithmetic only. A result with FX or equity trades says so in its
assumptions; report it. - The profile summary is not an IMM EAD. Alpha times Effective EPE needs supervisory approval.
- The figures are only as good as the ORE simulation behind them; a clean summary does not validate the ORE calibration.
Going deeper
reference.md: every formula with its CRE paragraph, every constant from CRE52.72 Table 2, the ORE column meanings, and the published examples the tests reproduce.workflows/saccr-ead.mdandworkflows/exposure-profile.md: step by step.scripts/check_artifact.py RESULT.json: one-line verdict on a saved result. It recomputes the EAD identity, checks multiplier bounds, add-on sums and the Effective EE monotonicity.
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.