TqSdk Trading and Data
shinnytech/tqsdk-python
Answers TqSdk Python questions on market data, accounts, orders, margin trials, simulation and backtesting, using the library's own docs and examples.
Finds why a trading backtest crashed or gave odd results, sorts the cause into a runtime, logic or data error, fixes the code and checks the rerun metrics.
$ npx skills add HKUDS/Vibe-Trading --skill backtest-diagnose -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install HKUDS/Vibe-Trading backtest-diagnose --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agent/src/skills/backtest-diagnose .claude/skills/backtest-diagnose && rm -rf skills-srcUse ~/.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/
Install the "backtest-diagnose" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/backtest-diagnose into .claude/skills/backtest-diagnose/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "backtest-diagnose", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/backtest-diagnoseType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add HKUDS/Vibe-Trading --skill backtest-diagnose -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install HKUDS/Vibe-Trading backtest-diagnose --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .agents/skills && cp -r skills-src/agent/src/skills/backtest-diagnose .agents/skills/backtest-diagnose && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "backtest-diagnose" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/backtest-diagnose into .agents/skills/backtest-diagnose/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "backtest-diagnose", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add HKUDS/Vibe-Trading --skill backtest-diagnose -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install HKUDS/Vibe-Trading backtest-diagnose --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/agent/src/skills/backtest-diagnose .cursor/skills/backtest-diagnose && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "backtest-diagnose" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/backtest-diagnose into .cursor/skills/backtest-diagnose/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "backtest-diagnose", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/HKUDS/Vibe-Trading.git --path agent/src/skills/backtest-diagnose--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add HKUDS/Vibe-Trading --skill backtest-diagnose -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install HKUDS/Vibe-Trading backtest-diagnose --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/agent/src/skills/backtest-diagnose .gemini/skills/backtest-diagnose && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "backtest-diagnose" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/backtest-diagnose into .gemini/skills/backtest-diagnose/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "backtest-diagnose", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install HKUDS/Vibe-Trading backtest-diagnoseInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add HKUDS/Vibe-Trading --skill backtest-diagnose -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .github/skills && cp -r skills-src/agent/src/skills/backtest-diagnose .github/skills/backtest-diagnose && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "backtest-diagnose" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/backtest-diagnose into .github/skills/backtest-diagnose/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "backtest-diagnose", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add HKUDS/Vibe-Trading --skill backtest-diagnose -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install HKUDS/Vibe-Trading backtest-diagnose --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/agent/src/skills/backtest-diagnose .opencode/skills/backtest-diagnose && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "backtest-diagnose" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/backtest-diagnose into .opencode/skills/backtest-diagnose/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "backtest-diagnose", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
backtest-diagnoseFinds why a trading backtest crashed or gave odd results, sorts the cause into a runtime, logic or data error, fixes the code and checks the rerun metrics.
When a backtest fails or performs strangely, this skill has the agent read the saved artifacts (metrics.csv, equity.csv and trades.csv) and the strategy code in signal_engine.py and config.json, classify the cause with a built-in taxonomy, edit the code, rerun, and read the new metrics to confirm the fix.
The taxonomy has three parts. Runtime errors such as ImportError, KeyError, IndexError and TypeError come with common causes and fixes, for example the signal must be a pandas Series. Logic bugs cover zero trades, a first trade more than two years after the start, capital utilization below half, and a position left open at the end. Data errors cover missing or too-short data. An ignore list names provider-side messages, such as rate or daily limits, where the code should not be changed because the data source is at fault. The excerpt is cut off after that list.
5 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 14cabaf. It shows what the files ask for, not the result of running them.
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.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Backtest Diagnosis loads about 1.2k tokens when it runs. Until then it costs about 26 tokens; SKILL.md has 663 words of instructions outside code blocks.
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.
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.
The full file from HKUDS/Vibe-Trading at commit 14cabaf, republished under its MIT licence (© HKUDS). 663 words, ~1,245 tokens.
.claude/skills/backtest-diagnose/SKILL.md (or your agent's skills folder).Use this skill when a user reports that a backtest failed, raised an error, or produced poor results.
read_file to inspect artifacts/metrics.csv, equity.csv, and trades.csvread_file to inspect code/signal_engine.py and config.jsonedit_file to modify the code, then rerun the backtestread_file to inspect the new metrics.csvexit_code != 0)| Error Type | Common Cause | Fix |
|---|---|---|
| ImportError | Missing dependency | bash("pip install xxx") |
| KeyError | DataFrame column-name mismatch | Check the actual column names in data_map |
| IndexError | Empty data or insufficient length | Add length checks |
| TypeError | Incorrect signal type | Ensure the return value is pd.Series |
trade_count=0): signal-logic bug. Conditions are too strict, so the signal stays at 0. Check whether entry and exit logic is reasonable, and inspect the signal series to confirm it is not all zeros.dropna is too aggressive.| Symptom | Root Cause | Fix |
|---|---|---|
| No data fetched | Invalid API token or code issue | Check config.json |
| Too little data | Date range too narrow | Expand the date range |
If you encounter the following keywords, do not modify the code. The problem is on the data-provider side:
rate limitAPI limitdaily limitInformation (common in Tushare API responses)These issues require the user to check the API token, switch data sources, or wait for the quota to reset.
artifacts/metrics.csv exists and is non-emptyartifacts/equity.csv exists and is non-emptytrade_count > 0 (0 trades means a signal bug)NaNexit_code == 0This Hard-Gate Checklist is also the evidence ingestion gate for Strategy Discovery: a run failing any gate produces no evidence rows — never partial rows — and is skipped with a stable machine-readable token (hard-gate:exit-nonzero, hard-gate:metrics-missing, hard-gate:zero-trades, hard-gate:equity-empty, hard-gate:equity-nan). Diagnose and fix the failing gate as usual, rerun the backtest, then repopulate the evidence cache with refresh_strategy_evidence (agent tool / MCP tool, or vibe-trading strategy-evidence refresh --manifest <path>) so the fixed run becomes queryable evidence. See the strategy-discovery skill for the manifest format and the full gate list.
write_file, unless the structure is fundamentally brokenAfter modifying signal_engine.py, you must confirm:
bash("python -c \"import ast; ast.parse(open('code/signal_engine.py').read()); print('OK')\"")class SignalEngine: the file must define class SignalEnginedef generate: the class must contain a def generate methodaction_items Writing RulesAfter diagnosis, output actionable improvement suggestions:
"Change X from A to B" or "Add X logic in signal_engine.py""Change RSI threshold from 30 to 25 in signal_engine.py line 42""Add signals = signals.fillna(0) after signal calculation to prevent NaN propagation""Add a volume filter: skip buy signals when volume is below the 20-day average"© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in agent/src/skills/backtest-diagnose of HKUDS/Vibe-Trading.
Open the folder on GitHubat commit 14cabaf
Backtest Diagnosis 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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Backtest Diagnosis this skillHKUDS/Vibe-Trading | 35k | — | ~1.2k | Automated safety check: Pass | MIT | |
| TqSdk Trading and Datashinnytech/tqsdk-python | 5.1k | — | ~2k | Automated safety check: Pass | Apache-2.0 | |
| The Art of Debuggingstas00/the-art-of-debugging | 1.7k | — | ~6.1k | Automated safety check: Notes | CC-BY-SA-4.0 | |
| Problem Solving ProHoangTheQuyen/think-better | 123 | — | ~2.8k | Automated safety check: Notes | MIT | |
| Bug DetectiveGalaxy-Dawn/claude-scholar | 5.7k | 1 repos | ~2.1k | Automated safety check: Pass | MIT | |
| Flowfile Debugging PlaybookEdwardvaneechoud/Flowfile | 373 | — | ~6.3k | Automated safety check: Pass | MIT |
shinnytech/tqsdk-python
Answers TqSdk Python questions on market data, accounts, orders, margin trials, simulation and backtesting, using the library's own docs and examples.
stas00/the-art-of-debugging
Condensed debugging method and tool recipes for Unix, Python and PyTorch programs: crashes, hangs, segfaults, wrong output, CUDA OOM, NaN values and slowness.
HoangTheQuyen/think-better
Systematic problem-solving toolkit: root cause analysis, hypothesis testing, debugging strategies, critical thinking frameworks.
Galaxy-Dawn/claude-scholar
Applies a systematic debugging workflow to errors, exceptions and failures, with error-type tables, localization techniques and reference notes for Python, JavaScript and shell.
Edwardvaneechoud/Flowfile
Symptom-to-cause triage playbook for Flowfile (core/worker/kernel/frontend/AI) — covers "no such table" DB cascades (two distinct causes), import-time Alembic migration corruption, silent…
glittercowboy/taches-cc-resources
Deep analysis debugging mode for complex issues. An agent skill from glittercowboy/taches-cc-resources.
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.
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.
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.
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.
HKUDS/Vibe-Trading
Breaks a structural trend such as AI infrastructure into its physical supply chain and ranks lesser-known listed companies sitting on each bottleneck.
HKUDS/Vibe-Trading
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.
Works with
Categories
Finds why a trading backtest crashed or gave odd results, sorts the cause into a runtime, logic or data error, fixes the code and checks the rerun metrics. json, classify the cause with a built-in taxonomy, edit the code, rerun, and read the new metrics to confirm the fix.
Backtest Diagnosis fits situations like: A backtest exits with an error and you need the cause found and fixed; A backtest finishes with zero trades or mostly idle capital; telling a real strategy bug apart from a data-provider limit or outage.
Run `npx skills add HKUDS/Vibe-Trading --skill backtest-diagnose -a claude-code`. Or copy the skill folder (agent/src/skills/backtest-diagnose in HKUDS/Vibe-Trading) into .claude/skills/backtest-diagnose in your project. Claude Code loads it when a task matches its description.
Run `npx skills add HKUDS/Vibe-Trading --skill backtest-diagnose -a codex`. Or copy the skill folder (agent/src/skills/backtest-diagnose in HKUDS/Vibe-Trading) into .agents/skills/backtest-diagnose in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/Vibe-Trading --skill backtest-diagnose -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/backtest-diagnose, .gemini/skills/backtest-diagnose, .github/skills/backtest-diagnose and .opencode/skills/backtest-diagnose in your project.
SKILL.md names no scripts, command-line tools or credentials: Backtest Diagnosis is instructions for the agent only. Our summary lists: A backtest run folder with artifacts, signal_engine.py and config.json.
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.
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.
Backtest Diagnosis is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.2k tokens (SKILL.md is roughly 5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Backtest Diagnosis: TqSdk Trading and Data (shinnytech/tqsdk-python, 5.1k stars), The Art of Debugging (stas00/the-art-of-debugging, 1.7k stars), Problem Solving Pro (HoangTheQuyen/think-better, 123 stars) and Bug Detective (Galaxy-Dawn/claude-scholar, 5.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 34,949 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 8, 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.