# Counterparty Risk

> Guide counterparty credit risk measurement and management for OTC and securities trading, organized around three workflows: assessing a new counterparty, responding to a credit-deterioration event, and executing a default close-out. Use when measuring current or potential future exposure to a counterparty, setting or reviewing counterparty credit limits, evaluating ISDA Master Agreement netting a…

- **Type:** Skill
- **Install:** `agentstack add skill-joellewis-finance-skills-counterparty-risk`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [JoelLewis](https://agentstack.voostack.com/s/joellewis)
- **Installs:** 0
- **Category:** [Finance & Payments](https://agentstack.voostack.com/c/finance-and-payments)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [JoelLewis](https://github.com/JoelLewis)
- **Source:** https://github.com/JoelLewis/finance_skills/tree/main/plugins/trading-operations/skills/counterparty-risk

## Install

```sh
agentstack add skill-joellewis-finance-skills-counterparty-risk
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Counterparty Risk

## Workflow A: Assessing a New Counterparty

1. **Identify the legal entity and verify netting enforceability.** Map the exact legal entity (not the corporate group), its jurisdiction, and entity type. Confirm close-out netting enforceability via ISDA netting opinions for that jurisdiction and entity-type combination before counting any netting benefit — where enforceability is uncertain, risk and capital must be measured gross. Apply the sovereign ceiling for counterparties in jurisdictions with material sovereign risk.
2. **Assess credit quality from three angles.** External ratings are a baseline but a lagging indicator — they typically reprice after the market has. Internal scoring: for banks, focus on CET1 (strong banks hold >12%), leverage ratio (well-capitalized banks target 5%+), LCR/NSFR (minimum 100%), and NPL trend; for corporates, debt/EBITDA, interest coverage (below 2x signals stress), free cash flow, and Altman Z-score, plus qualitative factors (management, franchise, regulatory standing). Market-implied: CDS spreads react fastest — annual PD ≈ CDS_spread / (1 − recovery); a 200bp spread at 40% recovery implies roughly 3.3% annual default probability.
3. **Determine the trading channel: cleared vs. bilateral.** Standardized interest rate swaps in major currencies and index CDS must clear under Dodd-Frank Title VII / EMIR (end-user hedging exemptions exist). Non-mandated products stay bilateral under the uncleared margin rules: zero VM threshold, IM threshold up to $50 million per counterparty group, and IM held segregated at a third-party custodian with no rehypothecation. Client clearing adds clearing-member risk: evaluate portability provisions and maintain a backup clearing member.
4. **Negotiate documentation.** ISDA Master Agreement (the 2002 version uses the Close-out Amount methodology; many legacy relationships remain on the 1992 version's Market Quotation/Loss — know which governs each relationship), Schedule elections (governing law, Specified Entities, cross-default thresholds, additional termination events such as NAV triggers), and CSA terms: threshold, minimum transfer amount, independent amount/IM, eligible collateral and haircuts, valuation frequency (daily is standard), and dispute resolution. Link the CSA threshold to ratings so it steps down — ideally to zero — on downgrade.
5. **Set the credit limit.** Tier by credit quality, with sub-limits by product and tenor (long-dated exposure is more uncertain) and a settlement limit separate from the pre-settlement limit. Apply explicit add-ons or reduced limits for wrong-way risk, where exposure and counterparty credit quality are positively correlated (general WWR: PD correlated with market factors; specific WWR: structural, e.g., a put written on the counterparty's own stock).
6. **Stand up measurement and monitoring.** Compute current exposure CE = max(V, 0); PFE at 95-97.5% confidence via Monte Carlo (simulate risk-factor paths, revalue the netting set at each time step, take the percentile of max(value, 0)); EE/EPE as the capital basis; EAD = 1.4 × (RC + PFE add-on) under SA-CCR; CVA = LGD × Σ EE_i × PD_i × DF_i. Aggregate across all desks, products, and legal entities facing the counterparty — a trade missing from the counterparty risk system is unmeasured exposure. Wire pre-deal limit checks into order flow, monitor post-trade for market-driven breaches, alert at ~80% utilization, and hard-block at 100%. Review cadence: annual full review for top-tier names, semi-annual for lower tiers, monthly (or more) for the watch list.

## Workflow B: Responding to a Credit-Deterioration Event

Early-warning thresholds that should put a counterparty on the watch list before any downgrade: sustained CDS widening (e.g., 50bp over 30 days, or absolute spread above 300bp), stock price decline >30% over 60 days, negative rating outlook, covenant breaches, regulatory enforcement actions, accounting restatements, or significant client withdrawals.

1. **Confirm and classify the trigger.** Initiate a formal credit review: temporary setback (a bad quarter, a one-time loss) or structural deterioration (capital erosion, rising NPLs, franchise decline)? Review the latest financials, disclosures, and analyst coverage.
2. **Enforce CSA downgrade provisions.** Check for ratings-linked threshold step-downs and additional termination events; call any collateral the CSA now permits (a threshold stepping to zero converts the prior threshold amount into an immediate collateral call).
3. **Reduce the credit limit.** Convene the credit committee and re-tier the counterparty. If current exposure now exceeds the reduced limit, document the breach and a dated remediation plan.
4. **Reduce exposure.** In rough order of cost: let maturing trades roll off without replacement; execute offsetting trades; novate trades to other counterparties (requires consent); unwind by agreement with a close-out payment. Prioritize long-dated, high-PFE trades for novation or unwind; short-dated trades maturing within weeks rarely justify early-termination costs.
5. **Restrict new trading.** Hold on exposure-increasing trades; require credit-officer approval for any new trade, which must be flat or exposure-reducing.
6. **Escalate monitoring to daily** — exposure, CDS, collateral disputes, news — and explicitly stress wrong-way risk by jointly shocking the exposure drivers and the counterparty's default (e.g., a European bank counterparty and euro depreciation that inflates FX-forward exposure simultaneously).
7. **Pre-position for default.** Pre-calculate close-out amounts and collateral adequacy, identify replacement counterparties for critical hedges, and confirm which agreement version and close-out methodology governs.
8. **Document everything** — committee decisions, limit rationale, the reduction plan, and communications — as evidence of prudent risk management for internal audit and examiners.

## Workflow C: Default Close-Out Playbook

Maintain this playbook pre-built for every watch-list counterparty: pre-drafted Event of Default and termination notices, pre-identified valuation sources (dealer panels, pricing services, internal marks), pre-computed exposure and collateral figures, and a contact tree (legal, credit, trading, operations). Close-out must execute in days, not weeks — every day of delay is unhedged market risk on the terminated portfolio.

1. **Confirm the Event of Default** under the governing Master Agreement (failure to pay, credit support default, cross-default above the threshold, bankruptcy, merger without assumption). Distinguish from Termination Events (illegality, force majeure, tax events, ATEs), which may permit termination of only the affected transactions.
2. **Deliver the default notice** using the pre-drafted form, observing the agreement's notice mechanics and grace periods.
3. **Designate the Early Termination Date** (same day or a future date, as the agreement permits).
4. **Value the terminated transactions** using commercially reasonable procedures — 2002 ISDA Close-out Amount (flexible but more subjective) or 1992 Market Quotation/Loss — drawing on the pre-identified valuation sources. Document quotes and marks contemporaneously; valuation disputes are the most litigated part of close-outs.
5. **Net to a single Early Termination Amount.** The single-agreement provision defeats cherry-picking by the bankruptcy estate: all transactions terminate together and net to one claim, including unpaid amounts. This is where the netting-enforceability verification from Workflow A pays off.
6. **Apply collateral** held under the CSA against the net amount. Expect exposure drift over the margin period of risk (regulatory MPOR ~10 business days bilateral, ~5 days cleared) between the last margin collection and final close-out — this is the exposure IM was sized to cover.
7. **Re-hedge the terminated portfolio** immediately. The close-out crystallizes the claim, but the market risk of the vanished trades is live until replaced.
8. **For cleared trades, the CCP runs default management instead.** The default waterfall applies resources in order: (1) the defaulter's initial margin, (2) the defaulter's default fund contribution, (3) the CCP's own capital (skin-in-the-game), (4) non-defaulting members' default fund contributions, (5) capped supplemental assessments, (6) recovery tools (variation margin gains haircutting, partial tear-up). CCPs size resources to the Cover 1 / Cover 2 standard — the default of the largest one or two members under extreme but plausible conditions. Clients of a defaulted clearing member should trigger porting of positions and margin to a backup member within one to two days.

## Core Reference

**Exposure measures (one line each).** Current exposure: CE = max(V, 0), where V is the net mark-to-market of the netting set. PFE: the high-percentile (95-97.5%) simulated exposure profile over time — rising with horizon, then rolling off as trades mature. EE/EPE: average exposure at a date / time-averaged EE, the basis for regulatory capital under SA-CCR and IMM. EAD (SA-CCR): 1.4 × (RC + PFE add-on). CVA: the market value of counterparty credit risk, a separate Basel III capital charge that raises the cost of bilateral OTC trades. Wrong-way risk: standard PFE models assume exposure-default independence — add joint stress scenarios where they correlate.

**Netting.** Payment netting reduces settlement flows; close-out netting is the credit-risk tool. Netting benefit = gross exposure − net exposure; netting ratio = net/gross (a ratio of 0.3 means netting cut exposure 70%). CCP multilateral netting nets across all clearing members and can exceed any bilateral result.

**Collateral.** VM covers current exposure (daily exchange, typically title transfer and reusable); IM covers close-out-period exposure (posted at inception, segregated, no rehypothecation under the uncleared margin rules). ISDA SIMM (sensitivity-based, recalibrated annually) generally produces lower IM than the regulatory schedule because it recognizes hedging and diversification. Typical haircuts: cash 0%; Treasuries 0.5-4% by maturity; investment-grade corporates 5-10%; equities 15-25%; plus ~8% FX haircut for non-domestic-currency collateral. Valuation disputes are routine — transfer the undisputed amount while escalating per the CSA.

**CCP margin methodology.** CCPs compute IM with historical-simulation VaR or Expected Shortfall at 99%+ confidence over the MPOR (typically 5 days for cleared swaps, 2 days for listed futures), plus concentration, liquidity, and wrong-way add-ons; VM is exchanged daily or intraday. Clearing concentrates risk in the CCP itself — CCPs are designated SIFMUs with heightened supervision, and members should assess each CCP's default waterfall adequacy.

**Settlement risk.** Settlement risk mechanics — DVP, PvP/CLS, Herstatt risk — are owned by the settlement-clearing skill (trading-operations); the counterparty-risk implication is that settlement limits must be set separately from pre-settlement limits because the exposure is full notional, not mark-to-market.

## Key Metrics and Formulas

| Metric | Expression | Use Case |
|--------|-----------|----------|
| Current Exposure | max(V, 0) | Point-in-time counterparty exposure |
| EAD (SA-CCR) | 1.4 * (RC + PFE_addon) | Regulatory capital calculation |
| Netting Ratio | Net_exposure / Gross_exposure | Netting effectiveness measurement |
| Implied PD from CDS | CDS_spread / (1 - Recovery_rate) | Market-implied default probability |
| Collateralized Exposure | max(V - C_adjusted, 0) | Exposure net of haircut-adjusted collateral |
| Uncollateralized Exposure | max(V - Threshold, 0) - Collateral_held | Residual exposure above CSA threshold |
| Limit Utilization | Current_exposure / Credit_limit | Credit limit monitoring |
| CVA | LGD * sum(EE_i * PD_i * DF_i) | Credit valuation adjustment |

where V = portfolio MTM, C_adjusted = collateral after haircuts, LGD = loss given default (1 - Recovery), EE_i = expected exposure at time i, PD_i = default probability in period i, DF_i = discount factor.

## Worked Examples

Two worked examples are in [references/examples.md](references/examples.md) — load for an end-to-end scenario: (1) setting up a counterparty credit limit framework with tiering, sub-limits, and governance, (2) designing collateral management for bilateral OTC trades under the uncleared margin rules.

## Common Pitfalls
- Relying solely on credit ratings as the primary indicator of counterparty creditworthiness — ratings are lagging indicators that often reflect deterioration only after the market has repriced the risk; CDS spreads and equity-implied metrics provide more timely signals
- Failing to verify netting enforceability in each counterparty's jurisdiction before counting netting benefits in exposure calculations — unenforced netting provides no risk reduction and regulators require gross exposure treatment where enforceability is uncertain
- Neglecting wrong-way risk in exposure measurement — standard PFE models assume independence between exposure and default probability, which can dramatically underestimate risk when the two are positively correlated
- Setting counterparty credit limits at inception but failing to reduce them when credit quality deteriorates — limits must be dynamic, with formal processes for downward revision triggered by early warning indicators
- Using a single aggregate credit limit without sub-limits by product type and tenor — a counterparty with a $200 million limit concentrated entirely in 30-year interest rate swaps presents fundamentally different risk than one with the same limit spread across short-dated FX forwards
- Treating the CSA threshold as a static parameter without linking it to the counterparty's credit rating — thresholds should step down (or reduce to zero) upon rating downgrade to ensure additional collateral is posted as credit quality weakens
- Failing to calculate and maintain pre-computed close-out amounts for counterparties on the watch list — if a counterparty defaults, the firm needs to act within hours, not days, to terminate and hedge
- Ignoring settlement risk for currencies not covered by CLS — the full notional of the first-delivered leg is exposed during the time-zone gap (mechanics in settlement-clearing)
- Assuming that central clearing eliminates counterparty risk entirely — clearing reduces but does not eliminate risk; the firm still faces clearing member default risk (for client clearers) and CCP tail risk, and must contribute to the default fund
- Permitting rehypothecation of initial margin received for uncleared derivatives — this violates uncleared margin rules and, even where not prohibited, introduces a chain of credit risk that defeats the purpose of initial margin
- Not stress testing the collateral portfolio for scenarios where collateral values decline simultaneously with exposure increases — a concentrated collateral portfolio of corporate bonds may lose value in the same market stress that increases derivative exposure
- Maintaining ISDA documentation with outdated Schedules that reference superseded regulations or contain stale credit thresholds, creating legal uncertainty about close-out mechanics and collateral obligations during a default event

## Cross-References
- **settlement-clearing** (trading-operations): Owns settlement risk mechanics — DVP/PvP, CLS, Herstatt risk, and fail management; clearing and settlement infrastructure are the structural mitigants for counterparty exposure.
- **margin-operations** (trading-operations): Owns Reg T and FINRA Rule 4210 brokerage margin; margin call workflows are the operational implementation of the collateral concepts in this skill.
- **trade-execution** (trading-operations): Pre-deal credit limit checks must be integrated into the trade execution workflow to prevent trades that would breach counterparty exposure limits.
- **o

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [JoelLewis](https://github.com/JoelLewis)
- **Source:** [JoelLewis/finance_skills](https://github.com/JoelLewis/finance_skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-joellewis-finance-skills-counterparty-risk
- Seller: https://agentstack.voostack.com/s/joellewis
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
