Agent skill

A Share Correlation

by aifinlab in aifinlab/FinClaw

A股相关性分析/联动关系/相关系数计算。当用户说"相关性"、"联动"、"correlation"、"XX和YY相关吗"、"哪些股票走势相似"、"分散化"、"对冲"、"beta"、"同涨同跌"、"相关性分析"、"相关系数"、"相关性矩阵"时触发。MUST USE when user asks about correlation analysis, correlation coefficient…

Apache-2.0Auto-check passedData & Analytics

Install A Share Correlation

skills CLI
$ npx skills add aifinlab/FinClaw --skill a-share-correlation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install aifinlab/FinClaw a-share-correlation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/aifinlab/FinClaw.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/a-share-correlation .claude/skills/a-share-correlation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
a-share-correlation
GitHub stars
254
Token cost
~569 tokens
SKILL.md length
162 words
Files
2 (incl. references)
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

A股相关性分析/联动关系/相关系数计算。当用户说"相关性"、"联动"、"correlation"、"XX和YY相关吗"、"哪些股票走势相似"、"分散化"、"对冲"、"beta"、"同涨同跌"、"相关性分析"、"相关系数"、"相关性矩阵"时触发。MUST USE when user asks about correlation analysis, correlation coefficient…

  • Works in 5 steps: 获取历史K线(多标的) → 计算相关系数矩阵(Correlation Matrix) → Beta 计算 → …
  • User asks about correlation analysis
  • SKILL.md covers 数据源, Workflow, 注意事项 and 使用示例
  • Calls python

What it does

A Share Correlation is an agent skill from aifinlab/FinClaw. A股相关性分析/联动关系/相关系数计算。当用户说"相关性"、"联动"、"correlation"、"XX和YY相关吗"、"哪些股票走势相似"、"分散化"、"对冲"、"beta"、"同涨同跌"、"相关性分析"、"相关系数"、"相关性矩阵"时触发。MUST USE when user asks about correlation analysis, correlation coefficient between stocks/sectors, or diversification analysis based on correlation. 计算个股/指数/行业之间的收益率相关系数、Beta值,分析联动关系和分散化效果,辅助组合构建和对冲决策。支持研报风格(formal)和快速查看风格(brief)。

Its SKILL.md is about 570 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/correlation-guide.md`).

It sits in Data & Analytics. It works with pandas. The licence is Apache-2.0.

When your agent uses it

  • User asks about correlation analysis
  • Correlation coefficient between stocks/sectors
  • Diversification analysis based on correlation

Example prompts

  • “correlation”
  • “XX和YY相关吗”
  • “哪些股票走势相似”
  • “/a-share-correlation”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. 获取历史K线(多标的)
  2. 计算相关系数矩阵(Correlation Matrix)
  3. Beta 计算
  4. 滚动相关性分析(Rolling Correlation)
  5. 输出分析结果

What it can do on your machine

Read from SKILL.md and the folder at commit 9e62862. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

A Share Correlation loads about 569 tokens when it runs, and up to ~1.8k if it reads all its reference files. Until then it costs about 93 tokens; SKILL.md has 162 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~93
When it runs · the whole SKILL.md, loaded when a task matches
~569
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from aifinlab/FinClaw at commit 9e62862, republished under its Apache-2.0 licence (© aifinlab). 162 words, ~569 tokens.

Download SKILL.mdSave it as .claude/skills/a-share-correlation/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
a-share-correlation
description
A股相关性分析/联动关系/相关系数计算。当用户说"相关性"、"联动"、"correlation"、"XX和YY相关吗"、"哪些股票走势相似"、"分散化"、"对冲"、"beta"、"同涨同跌"、"相关性分析"、"相关系数"、"相关性矩阵"时触发。MUST USE when user asks about correlation analysis, correlation coefficient between stocks/sectors, or diversification analysis based on correlation. 计算个股/指数/行业之间的收益率相关系数、Beta值,分析联动关系和分散化效果,辅助组合构建和对冲决策。支持研报风格(formal)和快速查看风格(brief)。

A股相关性分析 (Correlation & Co-movement Analysis)

数据源

通过 cn-stock-data skill 获取数据:

  • kline 路由:多标的历史日K线(至少 1 年,推荐 2-3 年)
  • quote 路由:实时行情、所属行业

计算工具:Python numpy/pandas

  • pandas.DataFrame.corr() 计算皮尔逊相关系数矩阵
  • numpy 做回归计算 Beta
  • pandas.DataFrame.rolling().corr() 计算滚动相关性

Workflow

Step 1: 获取历史K线(多标的)
  • 解析用户输入,识别 2-10 个标的(个股代码/指数代码/行业ETF)
  • 通过 cn-stock-data 获取各标的日K线,时间跨度至少 1 年(默认 2 年)
  • 同时获取大盘基准(沪深300 / 上证指数)作为 Beta 计算基准
  • 对齐交易日,剔除停牌/缺失日期,确保数据完整性
  • 计算日收益率序列:r_t = (close_t - close_{t-1}) / close_{t-1}
Step 2: 计算相关系数矩阵(Correlation Matrix)
  • 基于日收益率序列,计算皮尔逊相关系数矩阵
  • 输出 N x N 矩阵表格,对角线为 1.0
  • 标注相关性强度等级(参考 references/correlation-guide.md):
    • |r| > 0.7:强相关(红色/深色标记)
    • 0.3 < |r| < 0.7:中等相关
    • |r| < 0.3:弱相关(绿色/浅色标记)
    • r < 0:负相关(特别标注)
  • 找出最高/最低相关性配对,重点分析
Step 3: Beta 计算
  • 对每个标的,以大盘指数(默认沪深300)为基准计算 Beta:
    • Beta = Cov(r_stock, r_market) / Var(r_market)
  • 解读 Beta 含义:
    • Beta > 1.2:高弹性,涨跌幅大于大盘
    • 0.8 < Beta < 1.2:与大盘同步
    • Beta < 0.8:防御型,波动小于大盘
    • Beta < 0:反向标的(极少见,如对冲类)
  • 同时计算 R-squared(拟合优度),判断 Beta 的可靠性
Step 4: 滚动相关性分析(Rolling Correlation)
  • 计算 60 日滚动相关性(可自定义窗口期)
  • 分析相关性的时间变化趋势:
    • 相关性是否稳定?波动区间?
    • 是否存在结构性变化(如某事件后相关性突增/骤降)?
    • 近期相关性 vs 长期相关性的偏离度
  • 用文字描述滚动相关性走势(如"近3个月相关性从0.3升至0.7")
Step 5: 输出分析结果

formal 风格:

  1. 分析概览:标的列表、数据区间、样本量
  2. 相关系数矩阵(热力图描述 + 数据表格)
  3. 关键配对分析(最强正相关、最强负相关、最弱相关各 top3)
  4. Beta 分析表(含 R-squared)
  5. 滚动相关性趋势分析
  6. 分散化建议:基于相关性矩阵,推荐低相关组合
  7. 风险提示

brief 风格(默认):

  1. 相关系数矩阵表格
  2. 一句话总结:关键联动关系 + Beta 特征
  3. 分散化结论:哪些标的适合同时持有
  4. 风险提示

注意事项

  • 相关性不稳定,会随市场环境变化,务必结合滚动相关性判断
  • 极端行情(如股灾、熔断)下相关性趋向 1,分散化失效
  • 相关不等于因果,不能仅凭高相关性推断业务联系
  • 分散化需要真正低相关的资产,同行业/同概念股往往高度相关
  • 停牌期间数据需剔除,否则会扭曲相关性计算
  • 数据为历史统计结果,不构成投资建议

使用示例

示例 1: 基本使用
python
# 调用 skill
result = run_skill({
    "param1": "value1",
    "param2": "value2"
})
示例 2: 命令行使用
bash
python scripts/run_skill.py --input data.json

© aifinlab, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/a-share-correlation of aifinlab/FinClaw.

  • SKILL.md
  • references/correlation-guide.md

Open the folder on GitHubat commit 9e62862

Compare with similar skills

A Share Correlation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

A Share Correlation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
A Share Correlation this skillaifinlab/FinClaw254—~569Automated safety check: PassApache-2.0
SeabornzLanqing/codex-claude-academic-skills4.6k16 repos~4.9kAutomated safety check: PassBSD-3-Clause
Fix Module Not Found ErrorNuitka/Nuitka15k—~519Automated safety check: PassAGPL-3.0
Chdb Datastorevemetric/vemetric3942 repos~1.4kAutomated safety check: PassApache-2.0
CSV Data Summarizercoffeefuelbump/csv-data-summarizer-claude-skill4682 repos~1.4kAutomated safety check: PassNone
Senior Data ScientistRaidriar7170/hermes-skilleval1256 repos~1.4kAutomated safety check: PassMIT

Similar skills

  • Seaborn

    zLanqing/codex-claude-academic-skills

    Statistical visualization with pandas integration. An agent skill from zLanqing/codex-claude-academic-skills.

    4.6k GitHub starsUsed in 16 repos~4.9k tokens
    Data & AnalyticsAuto-check passed
  • Diagnose and fix ModuleNotFoundError in Nuitka standalone binaries caused by missing implicit imports.

    15k GitHub stars~519 tokensUpdated yesterday
    Data & AnalyticsAuto-check passed
  • Chdb Datastore

    vemetric/vemetric

    A skill your agent uses when the user has tabular data (pandas DataFrame, parquet, csv, Arrow, json) and wants to filter, group, aggregate, join, or speed up slow pandas.

    394 GitHub starsUsed in 2 repos~1.4k tokens
    Data & AnalyticsAuto-check passed
  • CSV Data Summarizer

    coffeefuelbump/csv-data-summarizer-claude-skill

    Analyzes CSV files, generates summary stats, and plots quick visualizations using Python and pandas.

    468 GitHub starsUsed in 2 repos~1.4k tokens
    Data & AnalyticsAuto-check passed
  • Senior Data Scientist

    Raidriar7170/hermes-skilleval

    World-class data science skill for statistical modeling, experimentation, causal inference, and advanced analytics.

    125 GitHub starsUsed in 6 repos~1.4k tokens
    Data & AnalyticsAuto-check passed
  • Python Executor

    cortega26/chile-hub

    Execute Python code in a safe sandboxed environment via [inference.sh](https://inference.sh).

    113 GitHub starsUsed in 2 repos~1.5k tokens
    Data & AnalyticsAuto-check passed

More from aifinlab/FinClaw

All 74 skills in this repo
  • Bank Corporate Credit Dd

    aifinlab/FinClaw

    A skill your agent uses when the user asks for help with corporate credit due diligence, enterprise credit investigation, pre-loan review, borrower analysis, document collection, management…

    254 GitHub stars~952 tokensUpdated 4 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank corporate-risk monitoring assistant for enterprise litigation/penalty/enforcement scanning (处罚/诉讼/被执行/失信等).

    254 GitHub stars~751 tokensUpdated 4 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank corporate client operating-volatility monitoring assistant (经营监测/指标波动/预警解释).

    254 GitHub stars~605 tokensUpdated 4 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank post-loan visit follow-up assistant to turn visit notes/materials into a structured memo (摘要/关键更新/风险观察/用途核验/行动项).

    254 GitHub stars~544 tokensUpdated 4 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank corporate credit issue-list assistant (问题清单/补件清单/催办台账).

    254 GitHub stars~487 tokensUpdated 4 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank corporate credit approval-opinion drafting assistant (审批意见/条款建议/有条件同意).

    254 GitHub stars~549 tokensUpdated 4 mo ago
    Auto-check passed

Works with

Questions about A Share Correlation

What does A Share Correlation do?

A股相关性分析/联动关系/相关系数计算。当用户说"相关性"、"联动"、"correlation"、"XX和YY相关吗"、"哪些股票走势相似"、"分散化"、"对冲"、"beta"、"同涨同跌"、"相关性分析"、"相关系数"、"相关性矩阵"时触发。MUST USE when user asks about correlation analysis, correlation coefficient…. A Share Correlation is an agent skill from aifinlab/FinClaw. A股相关性分析/联动关系/相关系数计算。当用户说"相关性"、"联动"、"correlation"、"XX和YY相关吗"、"哪些股票走势相似"、"分散化"、"对冲"、"beta"、"同涨同跌"、"相关性分析"、"相关系数"、"相关性矩阵"时触发。MUST USE when user asks about correlation analysis, correlation coefficient between stocks/sectors, or diversification analysis based on correlation.

When should I use A Share Correlation?

A Share Correlation fits situations like: user asks about correlation analysis; correlation coefficient between stocks/sectors; diversification analysis based on correlation.

How do I install A Share Correlation in Claude Code?

Run `npx skills add aifinlab/FinClaw --skill a-share-correlation -a claude-code`. Or copy the skill folder (skills/a-share-correlation in aifinlab/FinClaw) into .claude/skills/a-share-correlation in your project. Claude Code loads it when a task matches its description.

How do I install A Share Correlation in Codex?

Run `npx skills add aifinlab/FinClaw --skill a-share-correlation -a codex`. Or copy the skill folder (skills/a-share-correlation in aifinlab/FinClaw) into .agents/skills/a-share-correlation in your project. Codex loads it when a task matches its description.

Can I use A Share Correlation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aifinlab/FinClaw --skill a-share-correlation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/a-share-correlation, .gemini/skills/a-share-correlation, .github/skills/a-share-correlation and .opencode/skills/a-share-correlation in your project.

What does A Share Correlation need to run?

Going by SKILL.md and its folder, A Share Correlation needs the command-line tools its instructions call (python). Our summary lists: Python 3.

Does A Share Correlation access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is A Share Correlation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does A Share Correlation use?

A Share Correlation is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does A Share Correlation use?

About 569 tokens (SKILL.md is roughly 2.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.2k tokens, read only when the agent opens those files.

What are the alternatives to A Share Correlation?

Skills that share tags, products or a category with A Share Correlation: Seaborn (zLanqing/codex-claude-academic-skills, 4.6k stars), Fix Module Not Found Error (Nuitka/Nuitka, 15k stars), Chdb Datastore (vemetric/vemetric, 394 stars) and CSV Data Summarizer (coffeefuelbump/csv-data-summarizer-claude-skill, 468 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains A Share Correlation?

aifinlab (a GitHub user) maintains it in aifinlab/FinClaw, which has 254 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on May 13, 2026.

Source: aifinlab/FinClaw on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.