开源Open source Agent Skill A股 · 港股 · 美股A-shares · Hong Kong · US

让 AI 助手用真实行情和确定性算法读 K 线 Let your AI agent read K-line charts with real data and deterministic math

kline-structure-chart 是给 Claude Code、Codex 等 AI 助手用的技能。一句话提问,助手运行 Python 在真实行情上计算 K 线结构、三重屏障风控计划、15 日正常波动范围和无前视回测,产出 JSON、PNG 结构图和离线交互看板。 kline-structure-chart is a skill for AI agents such as Claude Code and Codex. Ask one question and the agent runs Python on real market data to compute K-line structure, a triple-barrier risk plan, a 15-day normal volatility range and a no-lookahead backtest, delivered as JSON, a PNG chart and an offline interactive dashboard.

curl -fsSL https://raw.githubusercontent.com/xiongcp/stock-skill/main/install.sh | bash

macOS / Linux 一行安装,自动注册到已安装的 Claude Code、Codex 等助手。仅供研究,不构成投资建议。 One-line install on macOS / Linux; registers with the Claude Code, Codex and other agents it finds. For research only, not investment advice.

中际旭创 300308.SZ 离线交互看板演示 NVIDIA NVDA.US offline dashboard demo
中际旭创 300308.SZ 离线交互看板录屏,数据截至 2026-10-15:拖动时间回放(每个历史截面只用当时数据,白线是之后的真实收盘),再切换图层与副图。下方"在线示例"可以亲手操作。 Screen recording of the NVIDIA NVDA.US offline dashboard, data as of 2026-10-15: dragging the history replay (each past snapshot uses only the data available then; the white line is the close that followed), then toggling layers and sub-charts. Try it yourself under "Live demos". On-screen labels are in Chinese.

为什么不让大模型直接看图Why not let an LLM read the chart directly

看截图问股有四个老问题。这个技能的做法是:计算交给 Python,助手只转述算出来的数字。 Asking a model about a chart screenshot has four familiar problems. This skill hands the computation to Python; the agent only relays the computed numbers.

常见问题Problem多模态模型看图读错坐标轴,编造不存在的价格,画错趋势线。Vision models misread axes, invent prices and draw the wrong trend lines.
这里的做法Here所有点位都由 Python 从真实 OHLCV 序列计算一次并写入 JSON,PNG 和 HTML 只读这份结果。Every level is computed once in Python from real OHLCV data and written to JSON; the PNG and HTML only read that result.
常见问题Problem拐点和形态事后用未来 K 线重绘,回测看似完美,实盘无法复现。Swing points and patterns are redrawn with future bars; the backtest looks perfect and cannot be reproduced.
这里的做法Here单边因果平滑,每个拐点记录确认日;回测在每个决策日只用当日及之前的数据重跑线上同一条流水线。One-sided causal smoothing and a confirmation day for every swing point; the backtest reruns the live pipeline on each decision day with only the data available then.
常见问题Problem把几个指标的加权分包装成"上涨概率",没有样本支撑。A weighted sum of indicators is presented as a "probability of going up", with no samples behind it.
这里的做法Here不输出上涨概率,规则分不叫胜率。唯一出现的胜率是回测成交胜率,附 Wilson 95% 区间和样本量。No probability of going up, and the rule score is never called a win rate. The only win rate shown is the backtest fill win rate, with a Wilson 95% interval and the sample size.
常见问题Problem大盘在跌还推荐追高;忽略 T+1、涨跌停、港股价位表和印花税等交易制度。Chasing breakouts while the market falls; ignoring T+1, price limits, Hong Kong tick tables and stamp duty.
这里的做法Here先大盘后个股:大盘环境评分低于 35 时风控一票否决做多。三市场交易制度按带生效日期和来源的规则实现。Market first: a regime score below 35 vetoes long setups. Each market's trading rules are implemented with effective dates and sources.

它能做什么What it does

CN · HK · US

三市场覆盖Three markets

A 股(沪深北个股、ETF、指数)、港股、美股,自动配对大盘基准(沪深300 / 恒生指数 / SPY)。A-shares (stocks, ETFs and indices), Hong Kong and US, each paired with its benchmark (CSI 300 / Hang Seng / SPY).

structure

K 线数学结构K-line structure

因果拐点、轨道拟合、ABC 浪型与推动 5 浪、8 类标准情景、蜡烛与双底双顶、RSI 背离、SMC、成交分布。Causal swing points, channel fitting, ABC and 5-wave counts, 8 standard scenarios, candlestick and double top/bottom patterns, RSI divergence, SMC and a volume profile.

risk plan

三重屏障风控计划Triple-barrier risk plan

入场区、止损、TP1/TP2、移动保本与持仓防守;给了账户净值就按单笔风险比例算股数。Entry zone, stop, TP1/TP2, move-to-breakeven and position defense; with an account size it computes shares from the per-trade risk fraction.

range

15 日正常波动范围15-day normal volatility range

以最新收盘价为中心的 50% / 80% 区间,只描述波动幅度、不判断方向,附滚动样本外覆盖率与折算有效样本量。50% / 80% bands centered on the latest close. They describe the size of moves, not direction, with rolling out-of-sample coverage and effective sample size.

backtest

无前视回测No-lookahead backtest

逐日回放线上计划,不学习任何参数;样本少于 30 笔时报告会明确提示参考价值低。Replays the live plan day by day without fitting any parameters; with fewer than 30 fills the report says the statistics carry little weight.

outputs

同源产物与回复守门One computation, checked replies

结果 JSON、1920×1160 结构图、离线交互看板和中文报告出自同一份计算;lint_response.py 拦截编造的价格和概率话术。Result JSON, a 1920×1160 chart, an offline dashboard and a Chinese report all come from one computation; lint_response.py blocks invented prices and probability claims.

在线示例Live demos

下面三组产物都由技能脚本基于真实行情生成(数据截至 2026-10-15),没有手工修改。交互看板是技能原样输出的离线 HTML,可以开关图层、拖动历史回放。 All three sets were generated by the skill's scripts from real market data (as of 2026-10-15) with no manual edits. The dashboards are the skill's offline HTML output as-is: toggle layers and drag the history replay slider.

示例中的数字只用于说明输出格式,不代表当前行情,也不构成投资建议。 Numbers in the examples only illustrate the output format. They do not reflect current prices and are not investment advice.

怎么用How it works

安装到你的助手Install into your agent

一行脚本、插件市场或 npx skills,装好后新开一个会话。One-line script, plugin marketplace or npx skills; then start a new session.

用自然语言提问Ask in plain language

"看看中际旭创的 K 线结构"、"NVDA 现在的风控计划是什么?"。只说名称时助手会先查代码,有歧义会请你选。"Show me NVDA's K-line structure, with a backtest" or "What's the risk plan for Tencent?". Given only a name, the agent looks up the ticker and asks you to choose if it is ambiguous.

拿到同源产物Get the outputs

回答按报告骨架组织:大盘 → 结构 → 风控 → 波动范围 → 回测 → 免责。同时得到 result.json、PNG 和 HTML。The answer follows the report: market → structure → risk plan → range → backtest → disclaimer, plus result.json, a PNG and the HTML dashboard.

安装Install

需要 Python 3.12+ 和 Pillow,推荐用 uv;每次分析需要访问新浪、Yahoo、腾讯的行情接口。 Needs Python 3.12+ and Pillow (uv recommended); every analysis needs access to the Sina, Yahoo and Tencent market-data endpoints.

macOS / Linux

curl -fsSL https://raw.githubusercontent.com/xiongcp/stock-skill/main/install.sh | bash

Windows (PowerShell)

安装脚本尚未在 Windows 上实测。The installer has not been tested on Windows yet.

irm https://raw.githubusercontent.com/xiongcp/stock-skill/main/install.ps1 | iex

Claude Code 插件市场Claude Code plugin marketplace

/plugin marketplace add xiongcp/stock-skill
/plugin install kline-structure-chart@stock-skill

npx skills

npx skills add xiongcp/stock-skill

让 AI 助手代装Let your AI agent install it

把下面这句话发给能执行命令的助手:Send this message to an agent that can run commands:

请按 https://raw.githubusercontent.com/xiongcp/stock-skill/main/INSTALL_FOR_AGENTS.md 的步骤,把 kline-structure-chart 技能安装到你自己的技能目录;需要安装 uv 或其他软件前先问我,完成后把 doctor 自检结果告诉我。
Follow the steps in https://raw.githubusercontent.com/xiongcp/stock-skill/main/INSTALL_FOR_AGENTS.md to install the kline-structure-chart skill into your own skills directory. Ask me before installing uv or any other software, and tell me the doctor self-check result when done.
Claude CodeCodexCursorGemini CLIOpenCodeHermes Agent

安装选项、不用 uv 的方式、命令行参数和故障排查见 README。 Installer options, installing without uv, CLI arguments and troubleshooting are in the README.

它不做什么What it does not do

不预测涨跌No up/down predictions

不输出上涨概率;规则分(0~100)是技术条件的加权打分,不是胜率;15 日区间只描述波动幅度,不是目标价。No probability of going up; the rule score (0–100) is a weighted score of technical conditions, not a win rate; the 15-day range describes the size of moves and is not a price target.

不造数据No fabricated data

只用新浪、Yahoo、腾讯的真实行情或你提供的本地真实文件;取不到就以 [DATA_UNAVAILABLE] 退出,不估算、不补数。Only real data from Sina, Yahoo and Tencent, or real local files you provide; if data is unavailable it exits with [DATA_UNAVAILABLE] instead of estimating.

不替你下单No order placement

只做规则化技术分析与研究验证,不连接券商、不执行交易。Rule-based technical analysis and research validation only; it does not connect to brokers or execute trades.

不做基本面No fundamentals

基本面、新闻、财报都不在范围内;成交分布是 OHLCV 近似,不等于真实持仓。Fundamentals, news and earnings are out of scope; the volume profile approximates traded volume from OHLCV and is not actual holdings.