Introduction¶
When doing A-share stock selection or post-market review, a common practice is to monitor the K-line charts of a few watchlist stocks, look for patterns that “look like a certain segment from last year” based on experience, and then make subjective judgments about whether the trend will continue. Comparing every stock in the entire market manually is costly, and hand-recording price movements is error-prone. If you want to turn “how many times this pattern has appeared in history and what the subsequent rise/fall probability is” into searchable statistics, you need a pattern matching workflow rather than just looking at a single chart.
Below is the community Skill on SkillHub: k-line Pattern Stock Picker (coordinate @user_2bda22ce/stockmatcher, current version 1.0.2). It is designed for Agents: when you describe stock selection, pattern matching, trend similarity, or historical backtesting needs in a conversation, it follows the skill documentation to call local scripts, searches for similar K-line segments across the entire market or within a single stock’s history, and outputs statistics such as subsequent returns and the probability of upward movement. SkillHub marks it as requires_api_key=false; the main workflow relies on Eastmoney or TongDaXin local data, so no API Key needs to be configured for the Skill itself.
What Is This¶
The introduction of k-line Pattern Stock Picker on SkillHub says: it can validate individual stock trends in the market’s history by using a user-defined recent time-window trend, thereby predicting trends over a period in the future.
More precisely, it is an Agent Skill based on SKILL.md (package identifier a-stock-pattern-matcher), maintained by community publisher user_2bda22ce, categorized as professional, source community. The skill documentation positions it as an A-share Intelligent Pattern Matching Stock Selection Tool: it compares historical trend patterns, finds the historical segment most similar to the target sequence, and summarizes the market performance after the matched segment for decision-making reference (historical statistics do not equal future returns).
- SkillHub page: https://www.skillhub.cn/skills/user_2bda22ce/stockmatcher
- API entry (SkillHub ecosystem): https://api.skillhub.cn/user_2bda22ce/stockmatcher
Core Features¶
The following capabilities come from the v1.0.2 skill documentation. When an Agent matches a trigger scenario (stock selection, pattern matching, trend similarity, finding similar stocks, historical backtesting, K-line analysis, etc.), it should execute according to the documentation.
- Manually input price changes: The user provides a comma-separated sequence of daily percentage changes, and the system searches the entire market for similar trends (the documentation calls this method the most flexible and reliable).
- Specify stock code: Take the most recent N trading days of a stock and search for matches across the entire market (
cross) or within its own history (self). - Screenshot recognition of K-lines: Extract the rise/fall sequence from a K-line screenshot (accuracy depends on image quality; Eastmoney/TongHuaShun daily K-lines recommended).
- Visual comparison: Generate charts of matching results.
- Statistical output: Subsequent N-day average return, probability of rising, win rate of high-similarity subset, etc.; similarity is a cosine similarity from 0 to 1.
Key changes in v1.0.2: Added TongDaXin local data support, removed tushare API dependency, prioritized Eastmoney as the data source with TongDaXin as backup, and fixed security issues such as hardcoded tokens.
Installation and Activation¶
SkillHub officially recommends letting the Agent pull the skill according to the installation instructions, with the coordinate @user_2bda22ce/stockmatcher.
1. Install SkillHub CLI (if not already installed)¶
First check if the CLI is already available:
command -v skillhub && skillhub --version
If not installed, use the complete installation command from the SkillHub documentation (requires internet access):
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash
To install only the CLI:
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash -s -- --cli-only
2. Install this Skill to the current Agent’s skills directory¶
When installing, you must use --dir to point to the skills directory recognized by the current client; otherwise it defaults to ./skills/ which may not be loaded. Common paths are as follows (excerpted from SkillHub installation documentation):
| Client | skills directory |
|---|---|
| Cursor | ~/.cursor/skills/ |
| Claude Code | ~/.claude/skills/ |
| Codex | ~/.codex/skills/ or .agents/skills/ under the project |
Example in Cursor:
skillhub install @user_2bda22ce/stockmatcher --dir ~/.cursor/skills/
You can also send the following prompt to the AI to let it complete the installation according to https://skillhub.cn/install/skillhub.md:
Please install `@user_2bda22ce/stockmatcher` according to https://skillhub.cn/install/skillhub.md.
3. Python dependencies and data environment¶
Scripts inside the skill directory (see “Script Locations” below) require:
pip install numpy pandas Pillow matplotlib openpyxl
Data sources (automatically selected by priority):
- Eastmoney local data (recommended): You can set the environment variable
EASTMONEY_DATA_PATHto point to the data directory; the documentation states it will automatically search the workspace directory structure. - TongDaXin local data: Available as a backup since v1.0.2 (see change notes).
The older script rhythm_pattern_matcher.py may still use tushare and requires TUSHARE_TOKEN; the main program smart_pattern_matcher.py is described in v1.0.2 as using purely local data sources. Results are written to pattern_results/ under the skill working directory by default.
After installation or upgrade, restart or refresh the Agent according to your client’s requirements so the new Skill takes effect.
Typical Usage¶
Execute in the skill package root directory (containing SKILL.md and scripts/). The following commands and parameters are consistent with the official SKILL.md.
Mode 1: Manual price changes (recommended)¶
Suitable for scenarios where you already have a clear rise/fall rhythm and are not tied to a specific stock code:
python scripts/smart_pattern_matcher.py --returns "2.1,-0.5,1.3,0.8,-1.2,-0.3,3.5,1.2,-0.8,2.0"
Commonly used parameters: --top (default 15), --threshold (minimum similarity, default 0.3), --after (subsequent observation days, default 10).
Mode 2: Specify stock code¶
# Full market search
python scripts/smart_pattern_matcher.py --code 002594 --window 15 --mode cross
# Own history search
python scripts/smart_pattern_matcher.py --code 600519 --window 20 --mode self
--window is the observation window in trading days (default 20); --mode takes cross or self.
Mode 3: K-line screenshot¶
python scripts/smart_pattern_matcher.py --image kline_screenshot.png
Mode 4: Full market scan¶
python scripts/smart_pattern_matcher.py --mode scan --window 20 --top 5
The documentation notes that this mode takes a long time (approximately 20–30 minutes), and the old version was affected by tushare rate limits; the v1.0.2 main program is primarily based on local data, but bulk scanning should still be used with caution.
How to read the output¶
| Indicator | Meaning |
|---|---|
| Subsequent N-day average return | Average rise after the matched segment over N days; positive indicates bullish, negative indicates bearish |
| Probability of rising | Proportion of rises after the matched segment; documentation example: threshold >70% is bullish, <40% is bearish |
| High-similarity win rate | Only counts matches with similarity ≥0.5 |
| Similarity | >0.7 highly similar; 0.5–0.7 has reference value; <0.3 weak reference significance |
Recommended window length: 5–10 days for short-term; 15–20 days as the documentation-recommended medium-term swing; 30–60 days for trend-level.
Applicable Scenarios and Caveats¶
Who it’s for
- Quantitative colleagues who need to complete “find stocks in the full market with similar trends to this segment” or “which historical segment does a stock’s recent 20 days look like” within a conversation.
- A-share researchers who already have or can configure Eastmoney/TongDaXin local market data and want to reduce online API rate limiting.
Limitations and notes
- The documentation explicitly states: history does not represent the future; a 70% probability of rising still means approximately a 30% chance of falling.
- Stocks with insufficient data due to trading halts or newly listed stocks will be skipped; full market search includes ST stocks by default.
- Screenshot recognition depends on image quality and is less stable than manually providing
--returns. - Full market scanning and first-time loading of local data take a long time; the documentation provides notes on loading and cache-related time consumption, which should be tested based on the machine and data volume.
- SkillHub page statistics (at time of crawling): rating 100000, downloads approximately 2425, installs approximately 54; it is a community Skill, so evaluate compliance and investment risks yourself before use.
Script locations (inside the skill package)
- Main program:
scripts/smart_pattern_matcher.py - TongDaXin interface:
scripts/tdx_local.py - Old version:
scripts/rhythm_pattern_matcher.py(tushare) - Formula references:
scripts/pattern_tdx.txt,scripts/pattern_em.txt
Conclusion¶
k-line Pattern Stock Picker converges “which recent trend looks like what, and how did similar historical segments perform afterwards” into a repeatable search and statistical workflow. It is suitable for attaching to Agents like Cursor, using natural language to trigger pattern matching tasks. Installation and priority source rules are subject to SkillHub’s official instructions; functional details are subject to the SKILL.md (v1.0.2) inside the skill package.
- SkillHub: https://www.skillhub.cn/skills/user_2bda22ce/stockmatcher
- Installation instructions: https://skillhub.cn/install/skillhub.md