← 返回 Skills 市场
tangweigang-jpg

Empyrical Risk Metrics

作者 Tang Weigang · GitHub ↗ · v0.3.3 · MIT-0
cross-platform ⚠ suspicious
114
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install empyrical-risk-metrics
功能描述
计算投资组合风险指标,包括年化收益率、夏普比率、索提诺比率、最大回撤和卡玛比率,支持滚动窗口统计和 NaN 数据处理,适用于多市场数据。。
使用说明 (SKILL.md)

投资风险指标 (empyrical-risk-metrics)

计算投资组合风险指标,包括年化收益率、夏普比率、索提诺比率、最大回撤和卡玛比率,支持滚动窗口统计和 NaN 数据处理,适用于多市场数据。

Pipeline

data_collection -> data_storage -> factor_computation -> target_selection -> trading_execution -> visualization

Top Use Cases (3 total)

Sphinx Documentation Build Configuration (UC-101)

Configuring Sphinx to automatically generate API documentation from docstrings and source code comments for the empyrical library Triggers: sphinx configuration, documentation build, autodoc setup

Documentation Deployment Automation (UC-102)

Automating the process of cleaning, building, and deploying Sphinx documentation to a hosting platform for the empyrical project Triggers: documentation deployment, automated deployment, CI/CD documentation

Advanced Sphinx Documentation Source Setup (UC-103)

Configuring advanced Sphinx extensions including autodoc filtering, numpydoc integration, and markdown support for comprehensive documentation generat Triggers: sphinx extensions, numpydoc, autodoc filtering

Execute trigger: When user intent matches intent_router.uc_entries[].positive_terms AND user uses action verb (run/execute/跑/执行/backtest/fetch/collect)

What I'll Ask You

  • Target market: A-share (default), HK, or crypto? (US stocks in ZVT are half-baked — stockus_nasdaq_AAPL exists but coverage is thin)
  • Data source / provider: eastmoney (free, no account), joinquant (account+paid), baostock (free, good history), akshare, or qmt (broker)?
  • Strategy type: MACD golden-cross, MA crossover, volume breakout, fundamental screen, or custom factor?
  • Time range: start_timestamp and end_timestamp for backtest period
  • Target entity IDs: specific stocks (stock_sh_600000) or index components (SZ1000)?

Semantic Locks (Fatal)

ID Rule On Violation
SL-01 Execute sell orders before buy orders in every trading cycle halt
SL-02 Trading signals MUST use next-bar execution (no look-ahead) halt
SL-03 Entity IDs MUST follow format entity_type_exchange_code halt
SL-04 DataFrame index MUST be MultiIndex (entity_id, timestamp) halt
SL-05 TradingSignal MUST have EXACTLY ONE of: position_pct, order_money, order_amount halt
SL-06 filter_result column semantics: True=BUY, False=SELL, None/NaN=NO ACTION halt
SL-07 Transformer MUST run BEFORE Accumulator in factor pipeline halt
SL-08 MACD parameters locked: fast=12, slow=26, signal=9 halt

Full lock definitions: references/LOCKS.md

Top Anti-Patterns (25 total)

  • AP-ZVT-183: 除权因子为 inf/NaN 时直接参与乘法导致复权静默失败
  • AP-ZVT-179: 第三方数据接口超限后异常被吞噬,数据静默缺失
  • AP-ZVT-183B: HFQ(后复权)与 QFQ(前复权)K 线表使用错误导致因子计算漂移

All 25 anti-patterns: references/ANTI_PATTERNS.md

Evidence Quality Notice

[QUALITY NOTICE] This crystal was compiled from blueprint finance-bp-107. Evidence verify ratio = 45.3% and audit fail total = 21. Generated results may have uncaptured requirement gaps. Verify critical decisions against source files (LATEST.yaml / LATEST.jsonl).

Reference Files

File Contents When to Load
references/seed.yaml V6+ 全量权威 (source-of-truth) 有行为/决策争议时必读
references/ANTI_PATTERNS.md 25 条跨项目反模式 开始实现前
references/WISDOM.md 跨项目精华借鉴 架构决策时
references/CONSTRAINTS.md domain + fatal 约束 规则冲突时
references/USE_CASES.md 全量 KUC-* 业务场景 需要完整示例时
references/LOCKS.md SL-* + preconditions + hints 生成回测/交易代码前
references/COMPONENTS.md AST 组件地图(按 module 拆分) 查 API 时

Compiled by Doramagic crystal-compilation-v6.1 from finance-bp-107 blueprint at 2026-04-22T13:00:51.147425+00:00. See human_summary.md for non-technical overview.

安全使用建议
This skill's description says 'risk metrics' but the runtime instructions assume a full ZVT backtesting environment (Python 3.12+, zvt, ZVT_HOME, access to market data providers) and include steps that can write to your home directory and install Python packages. Before installing or enabling it: 1) Confirm you are comfortable letting the agent run pip installs or init scripts — run these manually in a sandboxed venv if needed. 2) Expect to provide API keys or accounts for data sources (eastmoney/joinquant/akshare) even though they are not declared. 3) Review seed.yaml and references locally (they are included) to verify policies and semantic locks (they mandate trading rules like next-bar execution and T+1). 4) If you only need isolated metric computations, prefer running a vetted library locally (e.g., empyrical/pyfolio) rather than granting this skill permission to modify your environment or fetch market data. 5) If you proceed, run the skill in a controlled environment (container or conda/venv) and inspect any pip installs and filesystem changes first.
功能分析
Type: OpenClaw Skill Name: empyrical-risk-metrics Version: 0.3.3 The empyrical-risk-metrics skill bundle is a comprehensive configuration for a quantitative financial analysis assistant. It focuses on calculating risk-adjusted performance metrics (Sharpe, Sortino, etc.) and enforcing strict data integrity rules to prevent common backtesting errors like look-ahead bias and survivorship bias. The bundle uses a sophisticated 'crystal' architecture (v6.1) that includes semantic locks (SL-01 to SL-12) and extensive anti-pattern documentation (references/ANTI_PATTERNS.md) to guide the AI agent's behavior. While there is a slight mismatch between the core risk-metric purpose and the Sphinx documentation use cases (UC-101 to UC-103), the underlying code logic and constraints are entirely focused on financial engineering best practices. No evidence of malicious intent, data exfiltration, or unauthorized execution was found.
能力标签
crypto
能力评估
Purpose & Capability
Name/description state 'compute risk metrics' but SKILL.md describes a full pipeline (data_collection -> trading_execution -> visualization), Sphinx doc build/deploy use cases, and heavy reliance on ZVT and market data providers. The declared metadata lists no dependencies or env vars, yet the instructions clearly expect Python 3.12+, uv package manager, and ZVT tooling — this mismatch suggests the skill needs more privileges and dependencies than its summary implies.
Instruction Scope
SKILL.md instructs the agent to: re-read seed.yaml on behavioral decisions, run precondition checks via python (import zvt, query get_kdata), potentially run pip installs (python3 -m pip install zvt) and init_dirs, and to rely on ZVT_HOME and local ~/.zvt. It also references external data providers (eastmoney, joinquant, akshare, qmt). These runtime steps require filesystem writes and network access and are not limited to simple 'risk metric' calculations — the instructions therefore expand scope beyond what's stated and access env/config not declared in the registry metadata.
Install Mechanism
There is no formal install spec (lowest static risk), but SKILL.md contains explicit procedural install hints (pip install zvt, uv package manager requirement). That means at runtime an agent could attempt to modify the host Python environment. Absence of an install recipe in metadata while instructing installs is an inconsistency the user should notice.
Credentials
Registry shows no required env vars or credentials, but the instructions reference ZVT_HOME and test writing to ~/.zvt, and expect access to third-party data providers (some of which require accounts/API keys). The skill does not declare these env vars (e.g., ZVT_HOME, any API keys for joinquant/qmt), so the declared environment access is incomplete and disproportionate to the simple 'risk metrics' description.
Persistence & Privilege
always:false and normal autonomous invocation are set (no elevated platform privilege). However, the instructions expect creating/initializing ~/.zvt and may install packages (pip), which gives the skill the ability to persist files and modify the Python environment. This is expected for a backtesting tool but is more privileged than a pure computation-only skill.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install empyrical-risk-metrics
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /empyrical-risk-metrics 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.3.3
v0.3.3: bilingual metadata injected. H1 shows 投资风险指标; tagline replaced with skill-specific Chinese hook; tags upgraded to Level 1-4.
v0.3.1
Remove install.sh — knowledge-only bundle. Host AI consumes directly from URL; no user-side installation needed. Fixes ClawHub suspicious flag.
v0.3.0
Doramagic crystal portfolio v0.3.0. Full 5-layer bp-009 standard. github.com/tangweigang-jpg/doramagic-skills
元数据
Slug empyrical-risk-metrics
版本 0.3.3
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Empyrical Risk Metrics 是什么?

计算投资组合风险指标,包括年化收益率、夏普比率、索提诺比率、最大回撤和卡玛比率,支持滚动窗口统计和 NaN 数据处理,适用于多市场数据。。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 114 次。

如何安装 Empyrical Risk Metrics?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install empyrical-risk-metrics」即可一键安装,无需额外配置。

Empyrical Risk Metrics 是免费的吗?

是的,Empyrical Risk Metrics 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Empyrical Risk Metrics 支持哪些平台?

Empyrical Risk Metrics 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Empyrical Risk Metrics?

由 Tang Weigang(@tangweigang-jpg)开发并维护,当前版本 v0.3.3。

💬 留言讨论