Wyckoff Trading Agent
This skill operates in two modes: Setup (Step 0) and Analysis (Steps 1–9). Step 0 runs only when prerequisites are missing; once everything is configured, jump directly to analysis.
Step 0: Environment Detection & Guided Setup
Run these checks in order. Stop at the first failure and guide the user to fix it before continuing.
0.1 CLI Installation Check
Run wyckoff --version.
0.2 Auth Check
Run wyckoff auth status.
- Logged in → proceed to 0.3. (Credentials are auto-saved; token expiry triggers automatic re-login.)
- Not logged in → guide registration and login:
- Tell user to open https://wyckoff-analysis.pages.dev/ to register an account.
- After registration, run:
wyckoff auth login <email> <password> (credentials will be persisted, no need to login again).
- Verify with
wyckoff auth status.
0.3 Data Source Check
Run wyckoff config show.
- tushare_token present → OK.
- tushare_token missing → guide:
- Tushare token is free, get it from https://tushare.pro/ after registration.
- Then run:
wyckoff config tushare <token>
- tickflow_api_key present → OK.
- tickflow_api_key missing → guide:
Note: At least one data source (tushare or tickflow) must be configured. Both are recommended for better coverage.
0.4 Model Check
Run wyckoff model list.
- Has models → proceed to Step 1.
- No models → guide:
wyckoff model add (interactive) or wyckoff model set <name> <provider> <api_key> --model <model_name>.
0.5 MCP Server Setup (Optional — Ask User)
After all checks pass, ask the user whether they want to register the Wyckoff MCP Server with their AI tools (Claude Code / Cursor / etc.).
User says yes → guide:
pip install "youngcan-wyckoff-analysis[mcp]"
claude mcp add wyckoff -- wyckoff-mcp
Once registered, the MCP client can directly call 14 Wyckoff tools (diagnose_stock, screen_stocks, get_signal_pending, etc.) without going through the CLI TUI.
If the user uses a non-Claude MCP client, guide them to add this to their MCP config:
{
"mcpServers": {
"wyckoff": {
"command": "wyckoff-mcp",
"env": {
"TUSHARE_TOKEN": "<token_from_wyckoff.json>",
"TICKFLOW_API_KEY": "<key_from_wyckoff.json>"
}
}
}
}
Credentials already saved in wyckoff.json are also auto-read by the MCP server, so env vars are optional if wyckoff login + wyckoff config have been run.
User says no / skip → proceed directly to analysis.
When all checks pass, print a brief summary and proceed to analysis.
CLI Operational Commands
When the user's intent is operational (not analysis), route directly to the appropriate CLI command instead of running the analysis pipeline:
| Intent |
Command |
| View portfolio |
wyckoff portfolio list |
| Add position |
wyckoff portfolio add <code> <shares> <cost> |
| Remove position |
wyckoff portfolio rm <code> |
| Set cash |
wyckoff portfolio cash <amount> |
| View signals |
wyckoff signal |
| View recommendations |
wyckoff recommend |
| Screen market |
wyckoff screen |
| Run backtest |
wyckoff backtest <code> |
| Generate report |
wyckoff report <codes> |
| Launch dashboard |
wyckoff dashboard |
| View chat logs |
wyckoff log |
| Manage memory |
wyckoff memory |
| Sync cloud data |
wyckoff sync |
| Cleanup local data |
wyckoff cleanup |
| Update CLI |
wyckoff update |
| Register MCP Server |
pip install "youngcan-wyckoff-analysis[mcp]" && claude mcp add wyckoff -- wyckoff-mcp |
For the full CLI reference, see rules/cli-setup-guide.md.
Input Protocol
Accept any combination of:
- Stock symbol(s), single or multiple.
holdings: [symbol+cost+qty, ...].
cash: available cash amount.
candidate: optional non-holding symbol.
- CSV file(s), image(s), text constraints/goals.
Infer scenario automatically:
holdings non-empty + candidate: rotation comparison + per-holding actions.
holdings non-empty + no candidate: per-holding add/reduce/hold/exit.
holdings empty + cash: empty-position cash deployment.
- No portfolio fields: symbol analysis flow.
Do not require users to explicitly say "switch/add/reduce/empty-position."
Full Capability Orchestration (Steps 1–9, Required Order)
Parse and normalize inputs.
- Normalize symbols to exchange-qualified format when possible.
- Parse holdings into
{symbol, cost, qty}.
- Preserve raw user inputs for output audit.
Acquire current time via system/tool first.
- Fetch current timestamp from tool/system.
- Convert to
Asia/Shanghai.
- Print
当前北京时间:YYYY-MM-DD HH:MM(UTC+8).
Decide trading availability with authoritative calendar checks.
- Judge weekday and continuous-auction windows:
09:30-11:30, 13:00-15:00 (Beijing time).
- Query authoritative trading calendar when holiday/adjusted-workday uncertainty exists.
- If not tradable, downgrade to post-market review + next-session plan + T+1-safe order strategy.
Fetch online data with source fallback.
- Follow
rules/source-fallbacks.md strictly for each symbol.
- Perform schema and row-count validation before accepting a source.
- Log fallback attempts and final source per symbol.
Integrate CSV/image modalities when provided.
- Use CSV as supplemental historical structure input and reconcile with fetched data.
- Treat chart images as micro-structure evidence; explicitly acknowledge image reception.
- Continue analysis if one modality fails and state exact failure cause.
Run Wyckoff structural analysis first.
- Analyze latest available window (target 500 trading days) with
MA50/MA200.
- Identify only evidenced phases/events (SC/ST/Spring/LPS/SOS/UTAD).
- Use event-date news search only for validation context, never as primary trade logic.
Produce portfolio decisions after structure analysis.
- For each holding, output one explicit action:
add / reduce / hold / exit.
- If candidate exists, compare against structurally weakest current holding and decide
switch / partial switch / hold.
- If holdings are empty and cash exists, output staged cash deployment suggestion.
Render plots only when session rules allow.
- Skip plotting during tradable intraday windows.
- When plotting is allowed, enforce all constraints in
rules/alpha-system-prompt.md.
Apply capability degrade policy.
- Never fabricate OHLCV rows, event timestamps, or trading status.
- If all sources fail for a symbol, mark
data_unavailable and continue others.
- If valid rows < 30, report
insufficient structure depth and avoid hard phase labels.
- If image parsing fails, explain reason and continue CSV/text/online path.
For detailed capability-routing policy, read rules/system-capability-playbook.md.
Fixed Output Contract
Always output in this order:
当前北京时间:YYYY-MM-DD HH:MM(UTC+8)
- Trading verdict:
当前是否可盘中交易:是/否 (with reason if no).
- Data audit table per symbol:
symbol, source_used, rows_kept, window_end_date, fallback_count.
- Wyckoff analysis: current cycle background and phase (only evidenced), key events with rationale, action boundaries respecting T+1.
- Portfolio action section (portfolio flow only): holdings snapshot, per-holding actions, candidate comparison, cash suggestion, final summary in Wyckoff tone.
- Plotting section (only when allowed by session rules).
Hard Constraints
- Do not change the fixed prompt wording unless explicitly requested.
- Do not fabricate missing OHLCV rows.
- Do not ignore image input if image is parseable.
- Do not use opaque white text boxes in chart annotations.
- If fetching data requires running Python scripts, run them only in a sandboxed environment.
- Prefer direct web/API fetch first; use Python scripts only when needed for fallback, parsing, or normalization.
Resources
rules/alpha-system-prompt.md: fixed role and hard rules.
rules/source-fallbacks.md: online source switching policy.
rules/system-capability-playbook.md: full system capability routing and degrade policy.
rules/cli-setup-guide.md: CLI installation, registration, MCP setup, and command reference.
- GitHub: https://github.com/YoungCan-Wang/Wyckoff-Analysis
1---2name: wyckoff3description: Wyckoff A-share analysis agent with full CLI + MCP integration. Detects local CLI installation, guides users through setup (install → register → configure data sources → configure model → optional MCP server), then executes Wyckoff-style volume-price analysis with auditable portfolio decisions. Supports first-time onboarding, daily operational workflows (portfolio management, signal queries, recommendations) via the wyckoff CLI, and 14-tool MCP server for Claude Code / Cursor integration.4---56# Wyckoff Trading Agent78This skill operates in two modes: **Setup** (Step 0) and **Analysis** (Steps 1–9). Step 0 runs only when prerequisites are missing; once everything is configured, jump directly to analysis.910## Step 0: Environment Detection & Guided Setup1112Run these checks in order. Stop at the first failure and guide the user to fix it before continuing.1314### 0.1 CLI Installation Check1516Run `wyckoff --version`.1718- **Success** → proceed to 0.2.19- **Failure** → guide installation:20 ```21 pip install youngcan-wyckoff-analysis22 ```23 Or one-line install:24 ```25 curl -fsSL https://raw.githubusercontent.com/YoungCan-Wang/Wyckoff-Analysis/main/install.sh | bash26 ```27 After install, verify with `wyckoff --version` again.2829### 0.2 Auth Check3031Run `wyckoff auth status`.3233- **Logged in** → proceed to 0.3. (Credentials are auto-saved; token expiry triggers automatic re-login.)34- **Not logged in** → guide registration and login:35 1. Tell user to open https://wyckoff-analysis.pages.dev/ to register an account.36 2. After registration, run: `wyckoff auth login <email> <password>` (credentials will be persisted, no need to login again).37 3. Verify with `wyckoff auth status`.3839### 0.3 Data Source Check4041Run `wyckoff config show`.4243- **tushare_token** present → OK.44- **tushare_token** missing → guide:45 - Tushare token is free, get it from https://tushare.pro/ after registration.46 - Then run: `wyckoff config tushare <token>`47- **tickflow_api_key** present → OK.48- **tickflow_api_key** missing → guide:49 - TickFlow provides real-time and historical A-share data.50 - Purchase at: https://tickflow.org/auth/register?ref=5N4NKTCPL451 - Then run: `wyckoff config tickflow <api_key>`5253Note: At least one data source (tushare or tickflow) must be configured. Both are recommended for better coverage.5455### 0.4 Model Check5657Run `wyckoff model list`.5859- **Has models** → proceed to Step 1.60- **No models** → guide: `wyckoff model add` (interactive) or `wyckoff model set <name> <provider> <api_key> --model <model_name>`.6162### 0.5 MCP Server Setup (Optional — Ask User)6364After all checks pass, **ask the user** whether they want to register the Wyckoff MCP Server with their AI tools (Claude Code / Cursor / etc.).6566- **User says yes** → guide:67 ```68 pip install "youngcan-wyckoff-analysis[mcp]"69 claude mcp add wyckoff -- wyckoff-mcp70 ```71 Once registered, the MCP client can directly call 14 Wyckoff tools (diagnose_stock, screen_stocks, get_signal_pending, etc.) without going through the CLI TUI.7273 If the user uses a non-Claude MCP client, guide them to add this to their MCP config:74 ```json75 {76 "mcpServers": {77 "wyckoff": {78 "command": "wyckoff-mcp",79 "env": {80 "TUSHARE_TOKEN": "<token_from_wyckoff.json>",81 "TICKFLOW_API_KEY": "<key_from_wyckoff.json>"82 }83 }84 }85 }86 ```87 Credentials already saved in `wyckoff.json` are also auto-read by the MCP server, so env vars are optional if `wyckoff login` + `wyckoff config` have been run.8889- **User says no / skip** → proceed directly to analysis.9091When all checks pass, print a brief summary and proceed to analysis.9293## CLI Operational Commands9495When the user's intent is operational (not analysis), route directly to the appropriate CLI command instead of running the analysis pipeline:9697| Intent | Command |98|---|---|99| View portfolio | `wyckoff portfolio list` |100| Add position | `wyckoff portfolio add <code> <shares> <cost>` |101| Remove position | `wyckoff portfolio rm <code>` |102| Set cash | `wyckoff portfolio cash <amount>` |103| View signals | `wyckoff signal` |104| View recommendations | `wyckoff recommend` |105| Screen market | `wyckoff screen` |106| Run backtest | `wyckoff backtest <code>` |107| Generate report | `wyckoff report <codes>` |108| Launch dashboard | `wyckoff dashboard` |109| View chat logs | `wyckoff log` |110| Manage memory | `wyckoff memory` |111| Sync cloud data | `wyckoff sync` |112| Cleanup local data | `wyckoff cleanup` |113| Update CLI | `wyckoff update` |114| Register MCP Server | `pip install "youngcan-wyckoff-analysis[mcp]" && claude mcp add wyckoff -- wyckoff-mcp` |115116For the full CLI reference, see `rules/cli-setup-guide.md`.117118## Input Protocol119120Accept any combination of:121- Stock symbol(s), single or multiple.122- `holdings`: `[symbol+cost+qty, ...]`.123- `cash`: available cash amount.124- `candidate`: optional non-holding symbol.125- CSV file(s), image(s), text constraints/goals.126127Infer scenario automatically:128- `holdings` non-empty + `candidate`: rotation comparison + per-holding actions.129- `holdings` non-empty + no `candidate`: per-holding add/reduce/hold/exit.130- `holdings` empty + `cash`: empty-position cash deployment.131- No portfolio fields: symbol analysis flow.132133Do not require users to explicitly say "switch/add/reduce/empty-position."134135## Full Capability Orchestration (Steps 1–9, Required Order)1361371. **Parse and normalize inputs.**138 - Normalize symbols to exchange-qualified format when possible.139 - Parse holdings into `{symbol, cost, qty}`.140 - Preserve raw user inputs for output audit.1411422. **Acquire current time via system/tool first.**143 - Fetch current timestamp from tool/system.144 - Convert to `Asia/Shanghai`.145 - Print `当前北京时间:YYYY-MM-DD HH:MM(UTC+8)`.1461473. **Decide trading availability with authoritative calendar checks.**148 - Judge weekday and continuous-auction windows: `09:30-11:30`, `13:00-15:00` (Beijing time).149 - Query authoritative trading calendar when holiday/adjusted-workday uncertainty exists.150 - If not tradable, downgrade to post-market review + next-session plan + T+1-safe order strategy.1511524. **Fetch online data with source fallback.**153 - Follow `rules/source-fallbacks.md` strictly for each symbol.154 - Perform schema and row-count validation before accepting a source.155 - Log fallback attempts and final source per symbol.1561575. **Integrate CSV/image modalities when provided.**158 - Use CSV as supplemental historical structure input and reconcile with fetched data.159 - Treat chart images as micro-structure evidence; explicitly acknowledge image reception.160 - Continue analysis if one modality fails and state exact failure cause.1611626. **Run Wyckoff structural analysis first.**163 - Analyze latest available window (target 500 trading days) with `MA50`/`MA200`.164 - Identify only evidenced phases/events (SC/ST/Spring/LPS/SOS/UTAD).165 - Use event-date news search only for validation context, never as primary trade logic.1661677. **Produce portfolio decisions after structure analysis.**168 - For each holding, output one explicit action: `add / reduce / hold / exit`.169 - If candidate exists, compare against structurally weakest current holding and decide `switch / partial switch / hold`.170 - If holdings are empty and cash exists, output staged cash deployment suggestion.1711728. **Render plots only when session rules allow.**173 - Skip plotting during tradable intraday windows.174 - When plotting is allowed, enforce all constraints in `rules/alpha-system-prompt.md`.1751769. **Apply capability degrade policy.**177 - Never fabricate OHLCV rows, event timestamps, or trading status.178 - If all sources fail for a symbol, mark `data_unavailable` and continue others.179 - If valid rows < 30, report `insufficient structure depth` and avoid hard phase labels.180 - If image parsing fails, explain reason and continue CSV/text/online path.181182For detailed capability-routing policy, read `rules/system-capability-playbook.md`.183184## Fixed Output Contract185186Always output in this order:1871. `当前北京时间:YYYY-MM-DD HH:MM(UTC+8)`1882. Trading verdict: `当前是否可盘中交易:是/否` (with reason if no).1893. Data audit table per symbol: `symbol`, `source_used`, `rows_kept`, `window_end_date`, `fallback_count`.1904. Wyckoff analysis: current cycle background and phase (only evidenced), key events with rationale, action boundaries respecting T+1.1915. Portfolio action section (portfolio flow only): holdings snapshot, per-holding actions, candidate comparison, cash suggestion, final summary in Wyckoff tone.1926. Plotting section (only when allowed by session rules).193194## Hard Constraints195196- Do not change the fixed prompt wording unless explicitly requested.197- Do not fabricate missing OHLCV rows.198- Do not ignore image input if image is parseable.199- Do not use opaque white text boxes in chart annotations.200- If fetching data requires running Python scripts, run them only in a sandboxed environment.201- Prefer direct web/API fetch first; use Python scripts only when needed for fallback, parsing, or normalization.202203## Resources204205- `rules/alpha-system-prompt.md`: fixed role and hard rules.206- `rules/source-fallbacks.md`: online source switching policy.207- `rules/system-capability-playbook.md`: full system capability routing and degrade policy.208- `rules/cli-setup-guide.md`: CLI installation, registration, MCP setup, and command reference.209- GitHub: https://github.com/YoungCan-Wang/Wyckoff-Analysis