A股均值回归策略

SkillCommerce & finance

A-share mean reversion strategy / oversold rebound analysis. Triggered when the user says "均值回归", "mean reversion", "超跌反弹", "偏离均值", "回归", "XX跌太多了会反弹吗", "布林带策略", or "超买超卖". Uses cn-stock-data to fetch K-line data, analyzes how far price/valuation has deviated, and builds mean reversion trading strate

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-mean-reversion/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: 选择回归基准

  • 价格均值回归:均线(MA20/MA60/MA120)作为基准
  • 估值均值回归:PE/PB 历史中位数作为基准
  • 行业相对回归:个股 vs 行业指数的相对强弱

Step 2: 计算偏离度

  1. 价格偏离度 = (Price - MA) / MA × 100%
  2. 估值偏离度 = (PE - PE_median) / PE_std
  3. Z-score 标准化

Step 3: 半衰期估计

  • 基于 Ornstein-Uhlenbeck 模型:dS = θ(μ-S)dt + σdW
  • 半衰期 = ln(2) / θ
  • 回归 ΔS = a + b×S_{t-1},半衰期 = -ln(2)/b
  • 半衰期越短,均值回归越快

Step 4: 交易信号

  • 超卖入场:Z-score < -2(偏离均值 2 个标准差)
  • 超买入场(做空/减仓):Z-score > +2
  • 退出:Z-score 回归至 ±0.5 以内

Step 5: 输出

维度formalbrief
偏离分析多基准偏离度+历史分布当前偏离度
半衰期OU 模型+Hurst 指数预计回归天数
回测完整绩效胜率+收益

默认风格:brief。

关键规则

  1. 均值回归前提是"均值存在"——趋势行情中均值会漂移
  2. Hurst 指数 < 0.5 表示均值回归特性,> 0.5 表示趋势特性
  3. A 股短期(1-4 周)有显著反转效应,是均值回归策略的基础
  4. 需区分"超跌反弹"和"趋势延续"——结合基本面判断
  5. 涨跌停限制可能延长回归时间

使用示例

示例 1: 基本使用

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

示例 2: 命令行使用

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

Signals

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