a-share-pairs-trading
A股配对交易/统计套利分析。当用户说"配对交易"、"pairs trading"、"统计套利"、"价差交易"、"XX和YY能配对吗"、"协整"、"spread"、"套利"时触发。基于 cn-stock-data…
Skill by aifinlab
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/aifinlab-a-share-pairs-trading
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: data, finance
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/a-share-pairs-trading
What's inside
- Skill name
a-share-pairs-trading- Description
- A股配对交易/统计套利分析。当用户说"配对交易"、"pairs trading"、"统计套利"、"价差交易"、"XX和YY能配对吗"、"协整"、"spread"、"套利"时触发。基于 cn-stock-data 获取双标的K线数据,进行协整检验、价差分析、交易信号生成。支持研报风格(formal)和快速分析风格(brief)。
- License
- Apache-2.0
- Instructions
- 77 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (3)
- SKILL.md
- pairs-trading-guide.md · references/
- pairs_analyzer.py · scripts/
SKILL.md (first lines)
# A股配对交易分析
## 数据源
```bash
SCRIPTS="$SKILLS_ROOT/cn-stock-data/scripts"
# 两只股票的K线
python "$SCRIPTS/cn_stock_data.py" kline --code [CODE1] --freq daily --start [日期]
python "$SCRIPTS/cn_stock_data.py" kline --code [CODE2] --freq daily --start [日期]
# 行情
python "$SCRIPTS/cn_stock_data.py" quote --code [CODE1],[CODE2]
```
**量化计算**:
```bash
QSCRIPTS="$SKILLS_ROOT/a-share-pairs-trading/scripts"
python "$QSCRIPTS/pairs_analyzer.py" --stock1 data1.json --stock2 data2.json --window 60
```
## Workflow
### Step 1: 选择配对标的
- 同行业/同概念板块优先(基本面相似性)
- 历史价格相关性 > 0.8 作为初筛条件
### Step 2: 协整检验
1. ADF 检验两个价格序列的平稳性(应为 I(1))
2. Engle-Granger 两步法:OLS 回归 → 残差 ADF 检验
3. p-value < 0.05 认为存在协整关系
### Step 3: 价差序列构建
- 方法 A:对数价格比 ln(P1/P2)
- 方法 B:OLS 残差法 P1 - β×P2 - α
- 计算 Z-score = (spread - mean) / std
### Step 4: 交易信号
- 开多价差:Z-score < -2(价差偏低)
- 开空价差:Z-score > +2(价差偏高)
- 平仓:Z-score 回归至 0 附近(±0.5)
- 止损:Z-score 超过 ±3
### Step 5: 输出
| 维度 | formal | brief |
|------|--------|-------|
| 协整检验 | 完整统计量+p值 | 结论(是/否) |
| 价差分析 | 时序图+分布 | 当前 Z-score |
| 回测 | 完整绩效指标 | 年化收益+夏普 |
| 半衰期 | OU 模型详细 | 天数 |
默认风格:brief。
## 关键规则
1. A 股 T+1 限制:当日买入次日才能卖出,配对交易需考虑此约束
2. 涨跌停:一方涨停另一方未涨停会导致价差异常扩大
3. 停牌风险:一方停牌导致无法对冲
4. 协整关系可能失效——需定期检验,建议滚动窗口
5. 交易成本:双边交易成本约 0.2%,需纳入回测
## 使用示例
### 示例 1: 基本使用
```python
# 调用 skill
result = run_skill({
"param1": "value1",
"param2": "value2"
})
```
### 示例 2: 命令行使用
```bash
python scripts/run_skill.py --input data.json
```From aifinlab/FinClaw, Apache-2.0.
More from aifinlab/FinClaw
- 0.461score
a-share-capital-allocation
aifinlab
A股资本配置/再投资分析/资本支出与股东回报评估。当用户说"资本配置"、"capital allocation"、"回购"、"增发"、"并购"、"钱怎么花的"、"XX在做什么并购"、"定增"、"再融资"、"股份回购"、"资本开支"、"资本配置策略"、"资本配置分析"、"CAPEX"、"股东回报"时触发。MUST…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
a-share-concept
aifinlab
A股概念板块/题材分析/热点概念追踪。当用户说"概念板块"、"题材"、"热点板块"、"概念股"、"XX概念"、"AI概念"、"新能源概念"、"XX板块有哪些股票"、"今天什么板块涨了"、"风口"、"概念板块分析"、"热点题材"时触发。MUST USE when user asks about…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
claims-material-check-accident-insurance-assistant
aifinlab
���û���Ҫ�����������������������ṹ������Ԥ���������Լ�顢�¹����֤�����顢��ҽ����ƥ���顢�����嵥����������ǰ����ʶ��ʱʹ�ñ�…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
a-share-board-analysis
aifinlab
A股涨跌停板分析/连板追踪/涨停板统计。当用户说"涨停"、"跌停"、"涨停板"、"连板"、"打板"、"炸板"、"涨停分析"、"今天多少家涨停"、"连板股"、"首板"、"二板"、"三板"、"涨停原因"、"XX涨停了"、"涨停板分析"时触发。MUST USE when user asks about…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
a-share-competitive-moat
aifinlab
A股企业护城河/竞争优势分析/竞争壁垒评估。当用户说"护城河"、"竞争优势"、"moat"、"壁垒"、"XX的护城河是什么"、"竞争力分析"、"可持续竞争优势"、"品牌溢价"、"转换成本"、"网络效应"、"护城河分析"、"竞争壁垒"时触发。MUST USE when user asks about…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
a-share-comps
aifinlab
A股可比公司分析/行业估值对标。当用户说"可比公司"、"估值对标"、"行业估值"、"comps"、"comparable company"、"同行对比"、"XX跟同行比怎么样"、"XX板块估值"、"可比公司分析"、"comps analysis"时触发。MUST USE when user asks about…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
claims-case-summary-audit-assistant
aifinlab
���û���Ҫ�ѷ�ɢ�����������������ʺ�������ˡ����ˡ�������˻��ڲ�����ʹ�õİ���ժҪʱʹ�ñ� skill�������ڻ������������顢�¹ʾ���˵���������¼��סԺ���ϡ���Ժ��¼�����֤������鱨�桢�������桢����…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
claims-case-summary-customer-service-assistant
aifinlab
���û���Ҫ�����ⰸ�����ϡ����̼�¼������״̬�������ڵ��ͨ��Ϣ�������ʺϿͷ������������Ա����Ӫ֧����Աʹ�õİ���ժҪʱʹ�ñ�…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
claims-material-check-life-insurance-assistant
aifinlab
���û���Ҫ���������������������ṹ������Ԥ���������Լ�顢������ʵ������ԭ�����֤�����顢�����˺��������ʸ����ϼ�顢�����嵥����������ǰ����ʶ��ʱʹ�ñ�…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
a-share-autocorrelation
aifinlab
A股自相关/序列相关性/收益率自相关结构分析。当用户说"自相关"、"autocorrelation"、"序列相关"、"收益率预测性"、"动量还是反转"、"自相关系数"、"ACF"、"PACF"、"Ljung-Box"、"收益率是否可预测"、"随机游走检验"时触发。MUST USE when user asks…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
a-share-cash-flow
aifinlab
A股现金流分析/自由现金流质量评估。当用户说"现金流"、"自由现金流"、"FCF"、"cash flow"、"经营现金流"、"XX的现金流怎么样"、"收现比"、"净现比"、"资本开支"、"现金流量表"、"现金流分析"、"现金流质量"时触发。MUST USE when user asks about cash…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
a-share-convertible-bond
aifinlab
A股可转债分析/转债策略/可转债估值与筛选。当用户提到"可转债"或"转债"就触发。关键词:"可转债"、"转债"、"convertible bond"、"转股"、"转股价值"、"双低策略"、"强赎"、"XX转债怎么样"、"可转债打新"、"转债溢价率"、"转债分析"、"可转债筛选"、"转债到期收益率"、"YTM"、"下修…
SkillDFreshness: D★ 261Claude Code +9
Signals
- Stars
- 261
- Forks
- 39
- Open issues
- 2
- Last commit (this folder)
- Mar 26, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/aifinlab/FinClaw
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from aifinlab
- 0.461score
claims-material-check-accident-insurance-assistant
aifinlab
���û���Ҫ�����������������������ṹ������Ԥ���������Լ�顢�¹����֤�����顢��ҽ����ƥ���顢�����嵥����������ǰ����ʶ��ʱʹ�ñ�…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
a-share-autocorrelation
aifinlab
A股自相关/序列相关性/收益率自相关结构分析。当用户说"自相关"、"autocorrelation"、"序列相关"、"收益率预测性"、"动量还是反转"、"自相关系数"、"ACF"、"PACF"、"Ljung-Box"、"收益率是否可预测"、"随机游走检验"时触发。MUST USE when user asks…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
claims-case-summary-audit-assistant
aifinlab
���û���Ҫ�ѷ�ɢ�����������������ʺ�������ˡ����ˡ�������˻��ڲ�����ʹ�õİ���ժҪʱʹ�ñ� skill�������ڻ������������顢�¹ʾ���˵���������¼��סԺ���ϡ���Ժ��¼�����֤������鱨�桢�������桢����…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
claims-case-summary-customer-service-assistant
aifinlab
���û���Ҫ�����ⰸ�����ϡ����̼�¼������״̬�������ڵ��ͨ��Ϣ�������ʺϿͷ������������Ա����Ӫ֧����Աʹ�õİ���ժҪʱʹ�ñ�…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
claims-material-check-life-insurance-assistant
aifinlab
���û���Ҫ���������������������ṹ������Ԥ���������Լ�顢������ʵ������ԭ�����֤�����顢�����˺��������ʸ����ϼ�顢�����嵥����������ǰ����ʶ��ʱʹ�ñ�…
SkillDFreshness: D★ 261Claude Code +9 - 0.461score
a-share-board-analysis
aifinlab
A股涨跌停板分析/连板追踪/涨停板统计。当用户说"涨停"、"跌停"、"涨停板"、"连板"、"打板"、"炸板"、"涨停分析"、"今天多少家涨停"、"连板股"、"首板"、"二板"、"三板"、"涨停原因"、"XX涨停了"、"涨停板分析"时触发。MUST USE when user asks about…
SkillDFreshness: D★ 261Claude Code +9
Cite this page
a-share-pairs-trading skill. Agent Mart. https://agentmart.dev/skills/aifinlab-a-share-pairs-trading (last updated 2026-10-24)