风险管理

人工智能 社区

技能解读

当前原文的自动摘译,尚未人工审校。

何时使用

将此技能用于涉及金融不确定性的场景,例如投资组合风险评估、信用风险评估或市场波动分析。当您需要数据驱动的见解来遵守法规(例如巴塞尔协议 III)或优化投资决策时,可以应用它。

关键能力

使用历史或蒙特卡罗模拟执行 VaR 计算。使用资产价格或违约概率等输入数据构建市场、信用或操作风险的风险模型。生成缓解策略,例如根据风险阈值建议止损水平或投资组合重新平衡。与数据源集成以进行实时分析,支持 CSV、JSON 或 API 源等格式。

使用模式

始终通过$OPENCLAW_API_KEY进行身份验证初始化。对于 CLI,直接通过管道输入数据;对于 API,对大型数据集使用异步调用。首先加载配置文件(例如,用于模型参数的 YAML)。常见模式:分析风险 -> 审查输出 -> 应用缓解措施。对于代码集成,导入 SDK 并将调用包装在 try- except 块中。示例 1:通过提供历史价格来分析股票投资组合的市场风险。示例 2:评估贷款组合的信用风险并生成缓解建议。

常用命令/API

使用 OpenClaw CLI 执行快速任务,或使用 REST API 进行编程访问。身份验证需要在您的环境中设置$OPENCLAW_API_KEY。 CLI 命令:openclaw risk analyze --type market --model var --input portfolio.csv --confidence 95 计算市场风险的 95% VaR;输出是一个带有指标的 JSON 文件。 API 端点:POST https://api.openclaw.ai/v1/risk/analyze 主体:{"type": "credit", "data": {"loans": [{"amount": 100000, "rating": "A"}]}, "model": "default-prob"}

集成说明

通过设置 $OPENCLAW_API_KEY 并在应用程序中使用 SDK 进行集成。对于 Web 应用程序,处理异步结果的 Webhook(例如,完成后 POST 到您的端点)。通过自定义适配器连接到彭博社等数据提供商;在配置中指定:{"data_source": "bloomberg", "api_endpoint": "https://api.bloomberg.com/data"}。通过链接输出确保与其他 OpenClaw 技能的兼容性,例如,将风险分析结果传递到财务分析技能中。

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
人工智能
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
94 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@diegosouzapw · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需简单配置
是否需要外部接口密钥
需要 · Vendor-specific
兼容的系统
未声明(默认跨平台)
运行环境要求
Python
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
网络行为
允许外网请求
安装命令数
无(仅作为资料)
作者说明文件(原文) SKILL.md

# risk-management

## Purpose
This skill enables quantitative analysis, modeling, and mitigation of financial risks. It processes data to calculate metrics like Value at Risk (VaR), stress testing, and suggests strategies to reduce exposure, such as hedging or diversification.

## When to Use
Use this skill for scenarios involving financial uncertainty, like portfolio risk assessment, credit risk evaluation, or market volatility analysis. Apply it when you need data-driven insights to comply with regulations (e.g., Basel III) or optimize investment decisions.

## Key Capabilities
- Perform VaR calculations using historical or Monte Carlo simulations.
- Build risk models for market, credit, or operational risks with inputs like asset prices or default probabilities.
- Generate mitigation strategies, such as recommending stop-loss levels or portfolio rebalancing based on risk thresholds.
- Integrate with data sources for real-time analysis, supporting formats like CSV, JSON, or API feeds.
- Output results in structured formats, including reports or JSON for further processing.

## Usage Patterns
Always initialize with authentication via `$OPENCLAW_API_KEY`. For CLI, pipe data inputs directly; for API, use asynchronous calls for large datasets. Start by loading configuration files (e.g., YAML for model parameters). Common pattern: Analyze risk -> Review outputs -> Apply mitigation. For code integration, import the SDK and wrap calls in try-except blocks. Example 1: Analyze a stock portfolio's market risk by providing historical prices. Example 2: Evaluate credit risk for a loan portfolio and generate mitigation recommendations.

## Common Commands/API
Use the OpenClaw CLI for quick tasks or the REST API for programmatic access. Authentication requires setting `$OPENCLAW_API_KEY` in your environment.

- CLI Command: `openclaw risk analyze --type market --model var --input portfolio.csv --confidence 95`  
  This calculates 95% VaR for market risk; output is a JSON file with metrics.

- API Endpoint: POST https://api.openclaw.ai/v1/risk/analyze  
  Body: `{"type": "credit", "data": {"loans": [{"amount": 100000, "rating": "A"}]}, "model": "default-prob"}`  
  Response: JSON object with risk score and strategies, e.g., `{"var": 5000, "mitigation": ["increase collateral"]}`.

- Code Snippet (Python):  
  ```python
  import openclaw
  openclaw.set_key(os.environ['OPENCLAW_API_KEY'])
  result = openclaw.risk.analyze(type='operational', data={'events': [100, 200]}, model='monte-carlo')
  print(result['mitigation'])
  ```

- Config Format: YAML for custom models, e.g.,  
  ```
  model:
    type: var
    parameters:
      window: 252  # trading days
      confidence: 0.95
  ```

## Integration Notes
Integrate by setting `$OPENCLAW_API_KEY` and using the SDK in your application. For web apps, handle webhooks for asynchronous results (e.g., POST to your endpoint on completion). Connect to data providers like Bloomberg via custom adapters; specify in config: `{"data_source": "bloomberg", "api_endpoint": "https://api.bloomberg.com/data"}`. Ensure compatibility with other OpenClaw skills by chaining outputs, e.g., pipe risk analysis results into a financial-analysis skill.

## Error Handling
Always validate inputs before commands (e.g., check for required fields like `--input`). For API calls, catch HTTP errors: if status >= 400, retry up to 3 times with exponential backoff. Common errors: 401 (unauthorized – check `$OPENCLAW_API_KEY`), 400 (bad request – verify JSON schema), or 500 (server error – log and notify). In code, use:  
```python
try:
    result = openclaw.risk.analyze(...)
except openclaw.APIError as e:
    if e.status == 401:
        print("Reauthenticate with $OPENCLAW_API_KEY")
    else:
        raise
```
Log all errors with timestamps and include debug flags, e.g., `openclaw risk analyze --debug`.

## Graph Relationships
- Related to: financial-analysis (shares finance tag for combined data processing), portfolio-management (uses risk outputs for optimization).
- Connected via: quantitative-analysis (common modeling techniques), mitigation-strategies (links to compliance tools).
- Dependencies: Requires financial cluster skills for data input; provides outputs for decision-making skills.

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。