← Back to Skills Marketplace
tangweigang-jpg

Empyrical Risk Metrics

by Tang Weigang · GitHub ↗ · v0.3.3 · MIT-0
cross-platform ⚠ suspicious
114
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install empyrical-risk-metrics
Description
计算投资组合风险指标,包括年化收益率、夏普比率、索提诺比率、最大回撤和卡玛比率,支持滚动窗口统计和 NaN 数据处理,适用于多市场数据。。
README (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.

Usage Guidance
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.
Capability Analysis
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.
Capability Tags
crypto
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install empyrical-risk-metrics
  3. After installation, invoke the skill by name or use /empyrical-risk-metrics
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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
Metadata
Slug empyrical-risk-metrics
Version 0.3.3
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is Empyrical Risk Metrics?

计算投资组合风险指标,包括年化收益率、夏普比率、索提诺比率、最大回撤和卡玛比率,支持滚动窗口统计和 NaN 数据处理,适用于多市场数据。。 It is an AI Agent Skill for Claude Code / OpenClaw, with 114 downloads so far.

How do I install Empyrical Risk Metrics?

Run "/install empyrical-risk-metrics" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Empyrical Risk Metrics free?

Yes, Empyrical Risk Metrics is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Empyrical Risk Metrics support?

Empyrical Risk Metrics is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Empyrical Risk Metrics?

It is built and maintained by Tang Weigang (@tangweigang-jpg); the current version is v0.3.3.

💬 Comments