Agent skill

Chanlun Pattern Recognition

by HKUDS in HKUDS/Vibe-Trading

Detects Chan theory price structures (fractals, strokes, pivots) and first, second and third buy and sell points from OHLCV bars using the czsc library, in Chinese.

MITAuto-check passedBusiness, Finance & HR

SKILL.md written in Chinese; this summary is our English description.

Install Chanlun Pattern Recognition

skills CLI
$ npx skills add HKUDS/Vibe-Trading --skill chanlun -a claude-code

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

GitHub CLI
$ gh skill install HKUDS/Vibe-Trading chanlun --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/HKUDS/Vibe-Trading.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agent/src/skills/chanlun .claude/skills/chanlun && 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
chanlun
GitHub stars
35k
Token cost
~658 tokens
SKILL.md length
147 words
Files
8 (incl. references)
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Detects Chan theory price structures (fractals, strokes, pivots) and first, second and third buy and sell points from OHLCV bars using the czsc library, in Chinese.

  • Marking fractals, strokes and pivot zones on a price series
  • SKILL.md covers 用途, 核心概念, 买卖点体系 and 依赖安装, plus 5 more sections
  • Runs Python scripts from its folder; calls pip
  • Generating buy and sell point signals from candlestick data for a backtest

What it does

The skill follows the Chan theory chain: raw candlesticks, merging of contained bars, fractal detection, strokes, pivot zones and finally buy and sell points. A table defines fractals (a top where the middle bar is highest, a bottom where it is lowest), strokes between adjacent opposite fractals, and pivots made of at least three strokes. First, second and third buy and sell points are described, each with its own reference page, and the work applies to any market with OHLCV data, including A-shares, crypto and futures.

Implementation uses the `czsc` package, version 0.9.68 or newer, installed with `pip install czsc requests pandas`. It is pure Python with an optional Rust backend and supports incremental updates. The text lists signal functions from `czsc.signals.cxt`, including pattern classification for 3, 5, 7, 9 and 11 strokes, and sets a signal convention of 1 for long, -1 for short and 0 for flat. Input is a list of `RawBar` objects with fields such as time, frequency, prices and volume. An example signal engine script is bundled.

When your agent uses it

  • Marking fractals, strokes and pivot zones on a price series
  • Generating buy and sell point signals from candlestick data for a backtest
  • Classifying three-, five- or seven-stroke patterns across several timeframes

Example prompts

  • “Run chanlun analysis on the daily bars in data/btc_daily.csv and list the buy and sell points found.”
  • “用缠论识别这只股票的分型、笔和中枢,并说明最近一个三买信号。”
  • “Wrap the czsc signals into a signal engine that outputs 1, -1 or 0 for my backtester.”

Requirements

  • Python with `czsc`, `requests` and `pandas` installed
  • OHLCV bar data for the instrument

What it can do on your machine

Read from SKILL.md and the folder at commit b1f6ce7. 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

    Ships script files (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • pip

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

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    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

Chanlun Pattern Recognition loads about 658 tokens when it runs, and up to ~3.1k if it reads all its reference files. Until then it costs about 26 tokens; SKILL.md has 147 words of instructions outside code blocks.

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

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 HKUDS/Vibe-Trading at commit b1f6ce7, republished under its MIT licence (© HKUDS). 147 words, ~658 tokens.

Download SKILL.mdSave it as .claude/skills/chanlun/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
chanlun
description
基于缠论(缠中说禅)的形态识别引擎,使用czsc库自动检测K线分型、笔、中枢,并生成一买/一卖/二买/二卖/三买/三卖等买卖点信号。支持多周期分析和形态分类(3/5/7/9/11笔形态)。
category
strategy

缠论形态识别

用途

基于缠中说禅理论的价格形态识别。缠论是一套完全基于价格结构的技术分析方法,核心链路:

原始K线 → 去包含处理 → 分型识别 → 笔检测 → 中枢构建 → 买卖点判定

适用于任何有 OHLCV 数据的市场(A股、加密货币、期货等)。

核心概念

概念说明详细文档
分型(FX)顶分型:中间K线最高;底分型:中间K线最低分型
笔(BI)相邻顶底分型之间的一段走势,最小单元笔
中枢(ZS)至少3笔构成的价格重叠区域,趋势的核心中枢

买卖点体系

买卖点含义详细文档
一买/一卖趋势结束后的第一个反转信号(背驰点)一买一卖
二买/二卖一买/一卖后回调不破底/顶的确认信号二买二卖
三买/三卖中枢上移/下移后回调不进入前中枢的信号三买三卖

依赖安装

bash
pip install czsc requests pandas

快速上手

python
from czsc import CZSC, RawBar, Freq
from datetime import datetime

# 准备 RawBar 列表(需按时间正序排列)
bars = [
    RawBar(symbol="BTC-USDT", id=0, dt=datetime(2026,1,1),
           freq=Freq.D, open=70000, close=71000,
           high=72000, low=69000, vol=1000, amount=71000000),
    # ... 更多K线
]

# 创建分析器,自动检测分型/笔/中枢
c = CZSC(bars)

# 访问结果
print(c.bi_list)    # 已完成的笔
print(c.bars_ubi)   # 未完成笔中的K线

可用信号函数(czsc.signals.cxt)

czsc 内置 43 个缠论信号函数,核心如下:

函数说明类型
cxt_first_buy_V221126一买信号买卖点
cxt_first_sell_V221126一卖信号买卖点
cxt_second_bs_V230320均线辅助二买二卖买卖点
cxt_third_bs_V230318均线辅助三买三卖买卖点
cxt_third_buy_V230228笔三买辅助买卖点
cxt_double_zs_V230311两中枢组合判断BS1中枢
cxt_three_bi_V230618三笔形态分类形态
cxt_five_bi_V230619五笔形态分类形态
cxt_seven_bi_V230620七笔形态分类形态
cxt_nine_bi_V230621九笔形态分类形态
cxt_eleven_bi_V230622十一笔形态分类形态
cxt_bi_base_V230228BI基础信号(方向/转折)基础
cxt_bi_end_V230312MACD辅助笔结束辅助
cxt_range_oscillation_V230620区间震荡判断辅助
cxt_zhong_shu_gong_zhen_V221221大小级别中枢共振中枢

信号约定

  • 信号引擎输出:1=做多,-1=做空,0=观望
  • 做多条件:一买信号 或 三笔向上盘背 或 五笔类一买
  • 做空条件:一卖信号 或 三笔向下盘背 或 五笔类一卖
  • 中枢辅助:价格在中枢下沿附近做多优势,上沿附近做空优势

数据格式

czsc 接受 List[RawBar],每个 RawBar 包含:

字段类型说明
symbolstr标的代码
idint序号(从0开始)
dtdatetime时间
freqFreq频率:Freq.F1/F5/F15/F30/F60/D/W/M
openfloat开盘价
closefloat收盘价
highfloat最高价
lowfloat最低价
volfloat成交量
amountfloat成交额

实现方式

使用 czsc 库(v0.9.68+),基于纯 Python 实现(可选 Rust 加速后端)。支持增量更新,适合实时分析。

© HKUDS, MIT. 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 7 other files (references) in agent/src/skills/chanlun of HKUDS/Vibe-Trading.

  • SKILL.md
  • example_signal_engine.py
  • references/买卖点/一买一卖.md
  • references/买卖点/三买三卖.md
  • references/买卖点/二买二卖.md
  • references/核心概念/中枢.md
  • references/核心概念/分型.md
  • references/核心概念/笔.md

Open the folder on GitHubat commit b1f6ce7

Compare with similar skills

Chanlun Pattern Recognition 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.

Chanlun Pattern Recognition compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Chanlun Pattern Recognition this skillHKUDS/Vibe-Trading35k—~658Automated safety check: PassMIT
Tushare Datazillionare/zillionare3212 repos~2.3kAutomated safety check: PassNone
WorldQuant BRAIN Alpha ResearchQuantML-Research/wq-alpha-research407—~4.9kAutomated safety check: PassNone
Polymarket Tennislivetennisapi/livetennisapi-mcp152—~3kAutomated safety check: PassMIT
Tiger Brokers OpenAPI SDKqusong0627/QuantMind1.7k—~1.4kAutomated safety check: PassApache-2.0
Quant Blog Writingzillionare/zillionare321—~895Automated safety check: PassNone

Similar skills

  • Tushare Data

    zillionare/zillionare

    面向中文自然语言的 Tushare 数据研究技能。用于把“看看这只股票最近怎么样”“帮我查财报趋势”“最近哪个板块最强”“北向资金在买什么”“给我导出一份行情数据”这类请求,转成可执行的数据获取、清洗、对比、筛选、导出与简要分析流程。适用于 A 股、指数、ETF/基金、财务、估值、资金流、公告新闻、板块概念与宏观数据等研究场景。

    321 GitHub starsUsed in 2 repos~2.3k tokens
    Business, Finance & HRAuto-check passed
  • WorldQuant BRAIN Alpha Research

    QuantML-Research/wq-alpha-research

    Chinese-language playbook for WorldQuant BRAIN alphas: choose fields, write expressions, backtest, diagnose check failures, tune turnover, submit and build portfolios.

    407 GitHub stars~4.9k tokensUpdated 3 mo ago
    Business, Finance & HRAuto-check passed
  • Polymarket Tennis

    livetennisapi/livetennisapi-mcp

    Build observe-only Polymarket and Kalshi tennis market tooling on the polymarket-tennis Python package (MIT) plus the Live Tennis API free tier.

    152 GitHub stars~3k tokensUpdated 3 days ago
    Business, Finance & HRAuto-check passed
  • Tiger Brokers OpenAPI SDK

    qusong0627/QuantMind

    Covers the Tiger Brokers OpenAPI Python SDK for market data, stock, futures and options trading, push subscriptions, a CLI and an MCP server, defaulting to paper trading.

    1.7k GitHub stars~1.4k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Quant Blog Writing

    zillionare/zillionare

    撰写文笔精炼、富有深度的量化交易博文,论点清晰、证据确凿、叙事层次更加丰富。适用于量化交易博文、因子研究、回测复盘、数据源排查、市场微观结构、策略原理、风险控制、职业观察、量化人物故事等选题。文章将聚焦具体角度,提供详实的大纲、证据规划及成稿,力求内容兼具思想深度与诚实性,而非单纯口号式宣传;同时,通过人物经历、引言、贡献及行业背景的融入,让文章更具可读性和吸引力。

    321 GitHub stars~895 tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Web3 Polymarket

    Polymarket/agent-skills

    Polymarket integration for prediction market trading on Polygon.

    192 GitHub starsUsed in 1 repo~2k tokens
    Backend & APIsAuto-check passed

More from HKUDS/Vibe-Trading

All 89 skills in this repo
  • Eastmoney Market Data

    HKUDS/Vibe-Trading

    Index of Eastmoney's free, no-token market data interfaces for China A-shares and Hong Kong stocks: fund flows, dragon-tiger lists, margin trading, reports and news.

    35k GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • OKX Market Data

    HKUDS/Vibe-Trading

    Retrieves public OKX cryptocurrency market data such as spot prices, candlesticks, funding rates and open interest through the OKX V5 REST API, with no authentication.

    35k GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • SEC EDGAR Filings Fetcher

    HKUDS/Vibe-Trading

    Fetches U.S. SEC EDGAR data: resolves tickers to CIK numbers, lists recent 10-K, 10-Q and 8-K filings with document URLs, and pulls XBRL financial series.

    35k GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • A-Share ST Risk Screener

    HKUDS/Vibe-Trading

    Predicts whether a mainland China A-share company risks an ST or *ST warning after its next annual report, using financial thresholds and Sina penalty records.

    35k GitHub stars~4.9k tokensUpdated yesterday
    Auto-check passed
  • Breaks a structural trend such as AI infrastructure into its physical supply chain and ranks lesser-known listed companies sitting on each bottleneck.

    35k GitHub stars~2.7k tokensUpdated yesterday
    Auto-check passed
  • Plans and drafts an eight-part, roughly 120k-word investigative series on one company, built around a strict fact-check pass rather than fast drafting.

    35k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Chanlun Pattern Recognition

What does Chanlun Pattern Recognition do?

Detects Chan theory price structures (fractals, strokes, pivots) and first, second and third buy and sell points from OHLCV bars using the czsc library, in Chinese. The skill follows the Chan theory chain: raw candlesticks, merging of contained bars, fractal detection, strokes, pivot zones and finally buy and sell points. A table defines fractals (a top where the middle bar is highest, a bottom where it is lowest), strokes between adjacent opposite fractals, and pivots made of at least three strokes.

When should I use Chanlun Pattern Recognition?

Chanlun Pattern Recognition fits situations like: marking fractals, strokes and pivot zones on a price series; generating buy and sell point signals from candlestick data for a backtest; classifying three-, five- or seven-stroke patterns across several timeframes.

How do I install Chanlun Pattern Recognition in Claude Code?

Run `npx skills add HKUDS/Vibe-Trading --skill chanlun -a claude-code`. Or copy the skill folder (agent/src/skills/chanlun in HKUDS/Vibe-Trading) into .claude/skills/chanlun in your project. Claude Code loads it when a task matches its description.

How do I install Chanlun Pattern Recognition in Codex?

Run `npx skills add HKUDS/Vibe-Trading --skill chanlun -a codex`. Or copy the skill folder (agent/src/skills/chanlun in HKUDS/Vibe-Trading) into .agents/skills/chanlun in your project. Codex loads it when a task matches its description.

Can I use Chanlun Pattern Recognition 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 HKUDS/Vibe-Trading --skill chanlun -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/chanlun, .gemini/skills/chanlun, .github/skills/chanlun and .opencode/skills/chanlun in your project.

What does Chanlun Pattern Recognition need to run?

Going by SKILL.md and its folder, Chanlun Pattern Recognition needs Python for the scripts in its folder and the command-line tools its instructions call (pip). Our summary lists: Python with `czsc`, `requests` and `pandas` installed; OHLCV bar data for the instrument.

Does Chanlun Pattern Recognition access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Chanlun Pattern Recognition 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 Chanlun Pattern Recognition use?

Chanlun Pattern Recognition is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Chanlun Pattern Recognition use?

About 658 tokens (SKILL.md is roughly 2.6k 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 2.5k tokens, read only when the agent opens those files.

What are the alternatives to Chanlun Pattern Recognition?

Skills that share tags, products or a category with Chanlun Pattern Recognition: Tushare Data (zillionare/zillionare, 321 stars), WorldQuant BRAIN Alpha Research (QuantML-Research/wq-alpha-research, 407 stars), Polymarket Tennis (livetennisapi/livetennisapi-mcp, 152 stars) and Tiger Brokers OpenAPI SDK (qusong0627/QuantMind, 1.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Chanlun Pattern Recognition?

HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 35,097 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 9, 2026.

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