tdx2db CLAUDE.md

tdx2db CLAUDE.md is an instructions file for coding agents from xbfighting/tdx2db. It costs 1,771 tokens per session, scanned C, original, MIT.

Repository instructions for tdx2db, a tool that copies stock-market data from the local TongdaXin application into a database.

In plain words
What is it for?
Use it when developing tdx2db, installing its dependencies, syncing daily and minute-level Chinese stock data, checking database status, or updating stock and sector information.
Why use it?
It gives coding agents the project overview, setup commands, and the approved way to update and check data. It also separates contributor work from database querying.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/xbfighting/tdx2db/claude-md
Clone the repo
git clone --depth 1 https://github.com/xbfighting/tdx2db

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tdx2db CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/xbfighting/tdx2db/claude-md.svg)](https://agentmods.dev/instructions/xbfighting/tdx2db/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/xbfighting/tdx2db/claude-md"><img src="https://agentmods.dev/badge/instructions/xbfighting/tdx2db/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,771 This file is loaded in full into every session.
When invoked 1,771 The same file — it is already loaded in full.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01771 $0.01771
Opus 5 $0.00886 $0.00886
Sonnet 5 $0.00354 $0.00354
Haiku 4.5 $0.00177 $0.00177

Measured 4d ago against content hash 99e6bc17e5c3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

tdx2db CLAUDE.md scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf dist && uv build
CLAUDE.md · 97 lines

How it starts

The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

项目概述

tdx2db:从本地通达信(TDX)行情软件读取 A 股数据,增量同步到数据库。是量化分析工作站的数据入口。

本文件面向贡献者(改 tdx2db 代码)。如果你是在消费数据库(查询 daily_data 等表做分析),请读 AGENTS.md——schema、典型查询、陷阱清单都在那里,配套 skill 见 .claude/skills/tdx2db-query/

常用命令

# 安装依赖(开发模式,含 postgres/mysql 驱动)
pip install -e '.[all]'

# 一键增量同步(日线 + 5/15/30/60 分钟线)— 日常使用这一个命令即可
tdx2db sync

# 单独同步
tdx2db daily --db-only --auto-start --incremental
tdx2db minutes --db-only --auto-start --incremental

# 同步股票列表
tdx2db stock-list --db-only

# 数据库状态一览(只读,不需要 TDX_PATH;--json 机器可读)
tdx2db status

# 板块-个股关系同步(sync 已自动包含,也可单独跑)
tdx2db blocks --db-only

板块数据链(blocks.py,issue #39):概念/指数/风格 ← T0002/hq_cache/infoharbor_block.dat(文本,板块名 8 字节截断需经 880 码还原全名);行业 ← tdxhy.cfg X 码 × tdxzs3.cfg 类别 12(881 研究行业多级);跨市场指数成分 ← spblock.dat;地区 ← base.dbf DY 字段 × tdxzs.cfg 类别 3。全量替换式快照(DELETE+INSERT),与行情表的增量语义不同。旧二进制 block_zs/gn/fg.dat 在新版通达信不存在,pytdx BlockReader 不适用。

python main.py <子命令>tdx2db <子命令> 等价(main.py 是薄封装,保留老用户习惯)。包目录为 tdx2db/(v0.3.0 起从 src/ 改名,发布到 PyPI)。psycopg2-binary/pymysql 为可选依赖(extras: postgres/mysql/all),默认安装仅支持 SQLite。

测试:pytest tests/。CI 矩阵:ubuntu + windows × 3.9/3.11(+ ubuntu 3.10)——Windows 是用户主场景必须覆盖。tests/fixtures/ 存 .day/.lc5 二进制解析 fixture(合成字节,生成器 make_fixtures.py;断言值与生成参数一一对应)。数据正确性验证仍以运行 sync 后检查数据库为准。

发布 PyPI(维护者)

版本号需同步 bump 两处:pyproject.tomltdx2db/__init__.py(教训:v0.3.0 曾漏改后者)。发布 token 为项目级,存本地 .envPYPI_PROJECT_TOKEN(gitignored,勿打印其值):

rm -rf dist && uv build
UV_PUBLISH_TOKEN=$(grep '^PYPI_PROJECT_TOKEN=' .env | cut -d= -f2-) uv publish

发布后必须在全新 venv pip install tdx2db==<版本> 验证(含从工作目录读 .env 的脚本入口场景,教训见 v0.3.1)。增量/幂等类改动的冒烟必须跑两轮(首轮全量 + 次轮增量)。

架构

四层管道,单向数据流:

CLI (cli.py)  → Reader (reader.py) → Processor (processor.py) → Storage (storage.py)
    ↓                ↓                      ↓                        ↓
 argparse        pytdx 读取本地       校验 + 重采样 + 均线      SQLAlchemy 批量写库
 命令分发 +      .day/.lc5 文件       (OHLCV 校验, resample,   支持增量 ON CONFLICT
 同步编排                              MA5~MA250)               表名白名单保护

Read the full file on GitHub · 97 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 97 lines · 1,771 tokens per session scan C 99e6bc17e5c3

Subscribe to this mod's changes

tdx2db CLAUDE.md is an instructions file published in the GitHub repository xbfighting/tdx2db (149 stars, last pushed 13d ago), licensed MIT. It adds 1,771 tokens to every session, about $0.0089 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

teamdynamix-mcp teamdynamix.instructions.md

Instructions for GitHub Copilot when operating against a TeamDynamix instance via the MCP server.

selfagency/teamdynamix-mcp · 822 tokens

teamdynamix-mcp copilot-instructions.md

Copilot instructions for selfagency/teamdynamix-mcp, covering github copilot instructions, project goals, mcp architecture rules, typescript standards and error handling rules.

selfagency/teamdynamix-mcp · 485 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,345 tokens