A share drawdown analysis

From aifinlab/FinClaw · View interactive version

A share drawdown analysis is an AI agent skill from the GitHub repository aifinlab/FinClaw. A股回撤分析/最大回撤量化/回撤统计。当用户说"回撤"、"drawdown"、"最大回撤"、"回撤分析"、"回撤统计"、"历史回撤"、"水下曲线"、"亏了多少"、"从高点跌了多少"、"回撤修复"、"回撤天数"时触发。MUST USE when user asks about drawdown metrics, max drawdown calculation, or historical drawdown analysis for stocks/indices/portfolios. 基于 cn-stock-data 获取K线数据,量化分析历史回撤特征(最大回撤、回撤持续期、回撤修复时间、水下

How to use this skill

Skill file

A股回撤分析/最大回撤量化

数据源

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线数据

获取足够长的历史数据(建议 2 年以上)。

Step 2: 计算回撤序列

Step 3: 回撤事件分析

Step 4: 回撤统计

Step 5: 输出

| 维度 | formal | brief |

|------|--------|-------|

| 回撤序列 | 完整回撤图表+事件表 | 最大回撤值 |

| 统计分析 | 回撤分布+恢复时间 | 关键统计 |

| 风险评估 | 压力测试情景 | 当前回撤状态 |

默认风格:brief。

关键规则

  1. 最大回撤是衡量风险的核心指标之一
  2. 恢复时间往往比回撤深度更影响投资者体验
  3. A 股历史上大盘级别回撤:2008(-72%)、2015(-49%)、2018(-31%)
  4. 个股回撤通常远大于指数回撤
  5. 回撤期间的成交量放大通常意味着恐慌性抛售

使用示例

示例 1: 基本使用

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

示例 2: 命令行使用

python scripts/run_skill.py --input data.json
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.