Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By quantskillsGPL-3.0In 1 marketplace
Attributes realized portfolio returns by security and sector while reconciling fees, benchmarks, and input quality.
Claude hands work to one, or you mention it with @.
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
📌 定位:研究核算工具,用于解释组合已经发生的收益;不估计事前因子风险,也不构成投资建议。
| 能力 | 结果 |
|---|---|
| 证券归因 | 逐日权重、资产收益与贡献 |
| 行业归因 | 按 sector 汇总行业贡献 |
| 收益对账 | 毛收益、费用、净收益和基准主动收益 |
| 数据质检 | 拒绝重复键、缺失同日收益和非法数值 |
pip install -r requirements.txt
python scripts/attribute_portfolio.py --demo --output-dir out
处理真实数据前,请阅读 references/input_contract.md。最小运行示例:
python scripts/attribute_portfolio.py \
--positions positions.csv \
--returns returns.csv \
--benchmark benchmark.csv \
--fees fees.csv \
--output-dir attribution_out
| 数据 | 必需字段 | 说明 |
|---|---|---|
positions.csv | date,symbol,weight | 可选 sector |
returns.csv | date,symbol,asset_return | 收益为小数,例如 0.01 表示 1% |
benchmark.csv | date,benchmark_return | 可选,日期唯一 |
fees.csv | date,fee | 可选,按组合价值比例表示 |
脚本会生成:
security_attribution.csv:逐日逐证券的权重、收益和贡献。sector_attribution.csv:存在 sector 时的行业贡献汇总。daily_attribution.csv:毛收益、费用、净收益、基准收益和主动收益。summary.json:覆盖范围、累计收益、对账误差和警告。输入契约 → 日期与主键检查 → 同日连接 → 证券/行业归因 → 毛净收益对账 → 结果解释
当 reconciliation_error > 1e-10 时,应视为数据或舍入缺陷;权重和不为 1 时,保留结果但必须披露警告。
references/source_boundary.md。SKILL.md # Codex/Agent 工作流
scripts/attribute_portfolio.py # 确定性计算脚本
references/input_contract.md # 输入字段与数据约束
references/source_boundary.md # 资料边界
agents/openai.yaml # Agent UI 元数据
agents/cursor-rule.mdc # Cursor 运行时入口
agents/portable-loader.md # Hermes/便携运行时入口
requirements.txt # Python 依赖
node scripts/validate-qsh-form.mjs SKILL.md
python scripts/attribute_portfolio.py --demo --output-dir out
本仓库仅作研究方法层面的整理,非官方、不隶属任何被研究对象,不验证任何收益声明,不构成任何投资建议。
GNU General Public License v3.0,见 LICENSE。
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
portfolio-pnl-attribution@quantskills is listed by quantskills/registry — review the source before installing
npx claudepluginhub quantskills/registry --plugin portfolio-pnl-attributionPlugins from other owners that cover similar ground