ahel is live on Product Hunt today. Upvote

A股协整检验/长期均衡关系分析

SkillDev tools

A-share cointegration testing / long-run equilibrium analysis. Triggered when the user says "协整", "cointegration", "长期均衡", "价差平稳", or "XX和YY协整吗". Quantitatively tests cointegration relationships between stocks. Supports formal and brief styles.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the A股协整检验/长期均衡关系分析 skill

What this skill tells your AI

The instructions your AI receives, as published by aifinlab/finclaw in skills/a-share-cointegration-test/SKILL.md and read by ahel’s review.

数据源

SCRIPTS="$SKILLS_ROOT/cn-stock-data/scripts"
python "$SCRIPTS/cn_stock_data.py" kline --code [CODE] --freq daily --start [日期]
python "$SCRIPTS/cn_stock_data.py" quote --code [CODE]
python "$SCRIPTS/cn_stock_data.py" finance --code [CODE]

Workflow

Step 1: 获取多标的K线(价格序列)

Step 2: 单位根检验

  • ADF检验各序列是否I(1)
  • KPSS检验辅助确认

Step 3: 协整检验

  • Engle-Granger两步法
  • Johansen检验(多变量)

Step 4: 误差修正模型

估计长期均衡关系和短期调整速度

Step 5: 输出

维度formalbrief
单位根ADF+KPSS结果是否I(1)
协整检验统计量+p值是否协整
价差分析半衰期+均值回归参数配对可行性
默认风格:brief。

关键规则

  1. 协整是配对交易的理论基础——两股价差均值回归
  2. 协整关系可能随时间变弱或消失——需定期重新检验
  3. 同行业股票协整概率更高但非必然
  4. Johansen检验适合多变量,Engle-Granger适合两变量
  5. 半衰期过长(>60日)的协整关系实战价值有限

使用示例

示例 1: 基本使用

# 调用 skill
result = run_skill({
    "param1": "value1",
    "param2": "value2"
})

示例 2: 命令行使用

python scripts/run_skill.py --input data.json

Signals

GitHub stars
242
Forks
38
Last commit
May 2026
Advanced
Catalog kind
skill
Gateway key
a-share-cointegration-test
Source
github.com/aifinlab/finclaw