position-concentration-calculation

用于仓位/集中度的仓位与集中度计算原子 skill,适用于通用行业金融计算场景。

105 stars

Best use case

position-concentration-calculation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

用于仓位/集中度的仓位与集中度计算原子 skill,适用于通用行业金融计算场景。

Teams using position-concentration-calculation should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/position-concentration-calculation/SKILL.md --create-dirs "https://raw.githubusercontent.com/aifinlab/FinClaw/main/skills/archive/position-concentration-calculation/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/position-concentration-calculation/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How position-concentration-calculation Compares

Feature / Agentposition-concentration-calculationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

用于仓位/集中度的仓位与集中度计算原子 skill,适用于通用行业金融计算场景。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 仓位与集中度计算 Skill

## 数据来源

本 Skill 支持多种组合数据输入格式,核心数据来源包括:

### 1. 持仓数据
- **持仓明细**:证券代码、持仓数量、持仓成本、当前市值
- **权重数据**:各证券在组合中的权重占比
- **行业分类**:证券所属行业、板块分类
- **地区分类**:证券所属地区、市场类型

### 2. 组合数据
- **组合总资产**:组合总市值、总成本
- **组合结构**:股票、债券、现金等资产类别占比
- **组合规模**:组合资产规模、管理规模

### 3. 数据格式要求
- **CSV格式**:标准持仓数据,包含证券代码和权重列
- **Excel格式**:支持多工作表持仓数据
- **JSON格式**:结构化持仓数据
- **数据库连接**:支持SQL数据库直接查询

> 说明:本 Skill 不包含数据采集功能,需要用户提供清洗后的持仓数据。建议持仓数据完整且权重已归一化,以便进行准确的集中度计算。

---

## 功能

本 Skill 提供全面的仓位与集中度计算能力,涵盖多种计算方法:

### 1. 集中度指标计算
- **前N大持仓集中度** = Σ(前N大持仓权重)
- **HHI指数** = Σ(权重²),衡量集中度
- **有效持仓数量** = 1 / HHI,衡量分散程度
- **最大单持仓占比**:最大单只证券的权重占比

### 2. 行业集中度计算
- **行业集中度**:按行业统计的集中度
- **前N大行业集中度**:前N大行业的权重占比
- **行业HHI**:按行业计算的HHI指数
- **行业分散度**:行业的分散程度

### 3. 地区集中度计算
- **地区集中度**:按地区统计的集中度
- **市场集中度**:按市场类型统计的集中度
- **地区分散度**:地区的分散程度

### 4. 仓位分析
- **仓位分布**:分析仓位的分布特征
- **仓位变化**:分析仓位的时间变化
- **仓位预警**:设置集中度阈值进行预警

### 5. 数据处理能力
- **缺失值处理**:支持前向填充、均值填充等方法
- **异常值检测**:基于统计方法识别和处理异常权重
- **数据标准化**:支持不同数据源的格式统一
- **权重归一化**:自动归一化组合权重

---

## 使用示例

### 输出示例
```json
{
  "portfolio": "组合A",
  "date": "2024-12-31",
  "concentration": {
    "top1_weight": 8.5,
    "top5_weight": 25.3,
    "top10_weight": 42.8,
    "top20_weight": 65.2,
    "hhi": 0.085,
    "effective_holdings": 11.8,
    "max_single_weight": 8.5
  },
  "industry_concentration": {
    "top1_industry": "科技",
    "top1_weight": 35.2,
    "top3_weight": 58.5,
    "industry_hhi": 0.152,
    "effective_industries": 6.6
  },
  "statistics": {
    "total_holdings": 45,
    "total_weight": 100.0,
    "average_weight": 2.22,
    "median_weight": 1.5
  },
  "distribution": {
    "percentile_25": 0.8,
    "percentile_50": 1.5,
    "percentile_75": 3.2
  }
}
```

---

## 注意事项与限制

### 1. 数据质量要求
- 持仓数据需要经过清洗和验证
- 权重数据需要准确且归一化
- 行业分类需要准确且统一

### 2. 计算方法选择
- 不同计算方法的结果可能不同
- HHI指数对权重分布敏感
- 有效持仓数量需要足够样本量

### 3. 时间序列分析
- 集中度具有时间依赖性
- 不同时间点的集中度不可直接比较
- 需要考虑组合调整的影响

### 4. 综合判断原则
- 单一集中度指标不能全面反映组合特征
- 需要结合其他风险指标进行综合分析
- 应结合投资策略和市场环境进行判断

### 5. 使用限制
- 本 Skill 输出为技术分析结果,不构成投资建议
- 使用者应结合专业判断和具体业务场景
- 对于重大决策,建议咨询专业投资顾问

---

## 参考资料
- 见 references/ 目录中的相关文档,包括:
  - 集中度计算公式手册
  - HHI指数计算方法
  - 仓位分析方法指南
  - 数据处理方法说明文档

## License
- 本 skill 代码部分采用 MIT License,详见 `LICENSE` 文件
- 依赖与运行环境以 `requirements.txt` 为准
- 文档内容采用 CC BY 4.0 许可

Related Skills

futures-position-tracker

105
from aifinlab/FinClaw

期货持仓分析工具。获取期货品种持仓排名(前20名期货公司)、持仓结构(多头/空头)、持仓集中度。分析主力资金动向、持仓变化信号。使用交易所持仓数据、AkShare数据。适用于主力资金跟踪、市场情绪判断。

product-positioning-analysis

105
from aifinlab/FinClaw

面向基金产品管理领域的产品定位任务Skill,围绕「产品定位分析助手」场景提供信息抽取、结构化分析与结果输出。

holding-concentration-diagnosis

105
from aifinlab/FinClaw

面向基金投研分析领域的集中度诊断任务Skill,围绕「持仓集中度诊断助手」场景提供信息抽取、结构化分析与结果输出。

fund-product-positioning-assistant

105
from aifinlab/FinClaw

当用户需要在基金场景中完成产品定位分析助手相关任务时使用本技能,适用于产品定位及相关分析、生成、审阅请求。 用户提到「产品定位」「基金定位分析」「客群定位」或需要输出结构化中文结论、模板和配套脚本时,应优先触发。

excess-return-decomposition

105
from aifinlab/FinClaw

面向基金投研分析领域的收益拆解任务Skill,围绕「超额收益拆解助手」场景提供信息抽取、结构化分析与结果输出。

concentrated-position-warning-assistant

105
from aifinlab/FinClaw

当用户需要识别账户集中持仓风险、单一证券暴露过高、行业集中度过高、风格暴露失衡、流动性不足、客户持仓偏离风控要求或形成预警提示时使用。适用于券商、财富管理、风控、投顾及机构账户监控场景。

volatility-calculation

105
from aifinlab/FinClaw

用于风险波动的波动率计算原子 skill,适用于通用行业金融计算场景。

return-calculation

105
from aifinlab/FinClaw

用于区间/年化收益的收益率计算原子 skill,适用于通用行业金融计算场景。

max-drawdown-calculation

105
from aifinlab/FinClaw

用于回撤指标的最大回撤计算原子 skill,适用于通用行业金融计算场景。

financial-ratio-calculation

105
from aifinlab/FinClaw

用于计算企业财务比率的原子技能,包括盈利能力、偿债能力、营运能力和成长性指标。适用于财务报表分析、企业信用评估、投资研究和风险管理等金融场景。

style-factor-calculation

105
from aifinlab/FinClaw

用于因子暴露的风格因子计算原子 skill,适用于通用行业金融计算场景。

risk-return-matching-calculation

105
from aifinlab/FinClaw

用于适当性匹配的风险收益匹配计算原子 skill,适用于通用行业金融计算场景。