首页龙虾技能列表 › A Share Multifactor Model

A Share Multifactor Model

v1.0.0

A股多因子模型/Barra风格因子分析。当用户说"多因子"、"multifactor"、"Barra"、"因子模型"、"风格因子"、"XX的因子暴露"、"因子收益率"、"风险模型"时触发。基于 cn-stock-data 获取行情和财务数据,构建多因子风险模型,分析因子暴露、因子收益、协方差矩阵。支持研报风格(f...

0· 110·0 当前·0 累计
by @yzswk·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/29
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill's code, instructions, and requirements are coherent with a multifactor risk-modeling tool and do not request unexplained credentials or install arbitrary third-party code.
评估建议
This skill appears to do what it says: run local data-prep scripts and compute factor returns and covariances. Before installing, verify the following: 1) Confirm the referenced cn-stock-data scripts (under $SKILLS_ROOT/cn-stock-data) are trustworthy and inspect them for any network calls or credential usage, since SKILL.md assumes that dependency but doesn't declare it. 2) Ensure the CSV inputs you supply do not contain sensitive data you don't want processed. 3) Make sure required Python packa...
详细分析 ▾
用途与能力
Name/description match the included assets: SKILL.md explains workflows for factor construction and the repository includes a multifactor_builder.py that implements cross-sectional regression, factor statistics, and EWMA covariance. No unrelated binaries, credentials, or config paths are requested.
指令范围
Runtime instructions tell the agent to invoke cn-stock-data scripts under $SKILLS_ROOT and then run the local multifactor_builder.py. This is consistent with the described workflow, but the SKILL.md assumes the presence of a separate cn-stock-data skill at $SKILLS_ROOT (not declared as a dependency here). The instructions do not read arbitrary system files or exfiltrate data to external endpoints.
安装机制
No install spec is provided (instruction-only with one helper script). No external downloads or package installs are invoked by the skill itself.
凭证需求
The skill declares no required environment variables or credentials. The code reads CSV inputs (returns/exposures) and performs local numeric computations; it does not request tokens, secrets, or unrelated environment access.
持久化与权限
always is false and the skill does not modify agent configuration or request permanent presence. It runs as-needed and prints results to stdout; no privileged persistence behavior is present.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/29

Initial release of the A股多因子模型 skill: - Supports Barra风格与自定义因子的多因子模型分析,自动触发关键词包括“多因子”、“Barra”、“因子模型”等。 - 集成 cn-stock-data 获取A股行情与财务数据,自动构建因子、因子暴露、收益及协方差。 - 支持formal(研报)和brief(快速)两种报告风格,按用户需求切换输出细节。 - 实现因子标准化、去极值、缺失值处理,以及行业/市值中性化处理。 - 风险模型支持因子协方差(指数加权90天)、特质风险及股票分解分析。 - 默认剔除ST及上市不足60日新股,行业分类采用申万一级。

● 无害

安装命令 点击复制

官方npx clawhub@latest install a-share-multifactor-model
镜像加速npx clawhub@latest install a-share-multifactor-model --registry https://cn.clawhub-mirror.com

技能文档

数据源

SCRIPTS="$SKILLS_ROOT/cn-stock-data/scripts"

# 个股K线(计算动量/波动率因子) python "$SCRIPTS/cn_stock_data.py" kline --code [CODE] --freq daily --start [日期]

# 实时行情(市值/PE/PB等) python "$SCRIPTS/cn_stock_data.py" quote --code [CODE1],[CODE2],...

# 财务指标(ROE/营收增速等基本面因子) python "$SCRIPTS/cn_stock_data.py" finance --code [CODE]

量化计算

QSCRIPTS="$SKILLS_ROOT/a-share-multifactor-model/scripts"
# 多因子回归
python "$QSCRIPTS/multifactor_builder.py" --returns returns.csv --factors "size,value,momentum" --method ols

Workflow

Step 1: 确定因子体系

根据用户需求选择因子集:
  • Barra CNE5 风格:Size/Beta/Momentum/ResidVol/NLSize/BP/Liquidity/EarningsYield/Growth/Leverage
  • 自定义因子:用户指定的因子组合
  • 通过 cn-stock-data 获取原始数据(行情+财务)

Step 2: 因子计算与标准化

  • 从原始数据计算因子值
  • 去极值(MAD 法 ±3 倍)
  • 标准化(Z-score)
  • 缺失值处理(行业均值填充)

Step 3: 截面回归估计因子收益

  • 每期对股票收益 vs 因子暴露做 OLS 回归
  • 回归系数即为因子收益率
  • 计算因子收益的 t 统计量

Step 4: 构建风险模型

  • 因子协方差矩阵(指数加权)
  • 特质风险估计(回归残差的波动率)
  • 股票层面的风险分解

Step 5: 输出

维度formal(完整因子报告)brief(快速分析)
因子定义完整因子体系说明仅列出因子名
因子收益完整时序+统计检验近期因子收益排名
暴露分析个股因子暴露详表关键因子暴露值
风险模型协方差矩阵+特质风险
图表因子收益累计曲线
默认风格:brief。用户要求"详细"/"完整模型"时切换为 formal。

关键规则

  • 因子暴露需经行业和市值中性化处理
  • 因子协方差使用半衰期 90 天的指数加权
  • 特质收益率需检验正态性假设
  • A 股需剔除 ST 股和次新股(上市<60日)
  • 行业分类默认使用申万一级(31 个行业)
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务