mootdx

GitHub

提供通达信(TDX)协议的A股行情数据获取功能。因上游服务停止响应,已从默认回退链退役,仅支持显式调用,用于替代HTTP爬虫以获取OHLCV及实时行情。

agent/src/skills/mootdx/SKILL.md HKUDS/Vibe-Trading

Trigger Scenarios

需要获取A股历史K线或实时行情 指定使用mootdx作为数据源 尝试通过TCP协议绕过HTTP限制获取金融数据

Install

npx skills add HKUDS/Vibe-Trading --skill mootdx -g -y
More Options

Non-standard path

npx skills add https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/mootdx -g -y

Use without installing

npx skills use HKUDS/Vibe-Trading@mootdx

指定 Agent (Claude Code)

npx skills add HKUDS/Vibe-Trading --skill mootdx -a claude-code -g -y

安装 repo 全部 skill

npx skills add HKUDS/Vibe-Trading --all -g -y

预览 repo 内 skill

npx skills add HKUDS/Vibe-Trading --list

SKILL.md

Frontmatter
{
    "name": "mootdx",
    "category": "data-source",
    "description": "Mootdx A-share market data via TCP-direct 通达信 servers. RETIRED 2026-10 — TDX servers stopped answering the client protocol, so this source is out of the automatic fallback chain and kept only for explicit `source=\"mootdx\"` use."
}

Status (2026-10-08): retired from the default chain. TDX servers stopped answering the client protocol mootdx speaks (upstream: mootdx/mootdx#157), so this source is no longer in the automatic A-share fallback and is excluded from the loader-health canary. The loader stays registered for explicit source="mootdx" calls in case a future upstream release restores the protocol. For A-share OHLCV prefer tencent / eastmoney / baostock.

Overview

Mootdx talks the native 通达信 (TDX) binary protocol over TCP, bypassing the HTTP scrapers that periodically fail under load (akshare → East Money is the canonical example). Public market data only — no token, no per-IP throttling, no captcha.

Mootdx pins httpx<0.26 in setup.py, but only uses basic httpx.Client/get APIs that are forward-compatible. The second pip install restores the modern httpx that the rest of Vibe-Trading (MCP server, fastmcp) needs.

Quick Start

from mootdx.quotes import Quotes

client = Quotes.factory(market="std")  # std = 沪/深/京; ext = 期货/期权 (upstream-broken)

# Daily OHLCV with a date range (preferred API).
df = client.get_k_data(code="000001", start_date="2025-01-01", end_date="2025-02-01")

# Intraday — offset-from-latest only, no native date range.
df_15m = client.bars(symbol="600519", frequency=1, offset=800)

Frequency Codes

bars(frequency=N) uses integer codes from mootdx.consts:

Code Bar
8 1m
0 5m
1 15m
2 30m
3 1H
4 1D
5 1W
6 1M

get_k_data() is daily only but accepts start_date / end_date. For intraday, bars() returns the latest N rows — the built-in loader over-fetches offset=800 then clips to the requested window.

Key Methods

Method Use Returns
get_k_data(code, start_date, end_date) Daily OHLCV with date range [open, close, high, low, vol, amount, date, code]
bars(symbol, frequency, offset=800) Intraday / weekly / monthly [open, close, high, low, vol, amount, datetime, volume, ...]
minute(symbol) Current trading day 1m bars Same schema as bars()
quotes(symbol) Real-time L1 snapshot {price, bid, ask, volume, ...}
stocks(market) List all tickers on an exchange DataFrame of code/name
F10(symbol) / finance(symbol) Fundamentals snapshot Heterogeneous dict

Symbol Format

  • Pure 6-digit: "000001", "600519", "835174" — mootdx auto-detects exchange from prefix:
    • 60x / 68x → SH
    • 00x / 30x / 002 / 003 → SZ
    • 4x / 8x → BJ
  • The built-in loader also accepts "000001.SZ", "600519.SH", "835174.BJ" and strips the suffix.

Column Names

get_k_data() returns lowercase English: open / close / high / low / vol / amount / date / code. The built-in loader renames vol → volume to match the project's OHLCV contract.

bars() returns the same OHLC columns plus a duplicate volume (alongside the legacy vol), a datetime string column, and decomposed year / month / day / hour / minute columns.

Built-in Loader

backtest/loaders/mootdx_loader.py is registered as the mootdx source. Fallback chain for a_share is [tushare, mootdx, akshare] — tushare wins when a token is present; mootdx wins when no token but TCP egress works; akshare is the broadest fallback.

from backtest.runner import run
result = run(strategy=..., source="mootdx")  # explicit override

Known Limitations

Limitation Workaround
北交所 (BJ): get_k_data raises KeyError, bars() returns empty (upstream missing data) Loader logs a warning and skips BJ symbols — use akshare or tushare
Extended market (futures/options) returns empty as of v0.11.7 (upstream issue) Use tushare/akshare for futures
Each bars() page is 800 rows; loader paginates back up to 25 pages (≈10y daily / ≈5y 1H / ≈3mo 1m) For longer 1m history use tushare minute bars
Server selection has cold-start latency (first call picks the fastest server) First call may be ~2s slower
Returns data in 前复权 by default — no API parameter for 不复权 Use tushare/akshare if raw prices are required

Reference Docs

Version History

  • c546e87 Current 2026-10-19 04:45

    将mootdx从A股默认回退链和健康检查中退役,解决因上游服务不可用导致的延迟问题,但保留显式调用支持。

  • 0aa45a9 2026-07-24 17:46

Same Skill Collection

agent/src/skills/adr-hshare/SKILL.md
agent/src/skills/akshare/SKILL.md
agent/src/skills/alpha-zoo/SKILL.md
agent/src/skills/ashare-pre-st-filter/SKILL.md
agent/src/skills/asset-allocation/SKILL.md
agent/src/skills/backtest-diagnose/SKILL.md
agent/src/skills/behavioral-finance/SKILL.md
agent/src/skills/candlestick/SKILL.md
agent/src/skills/ccxt/SKILL.md
agent/src/skills/chanlun/SKILL.md
agent/src/skills/commodity-analysis/SKILL.md
agent/src/skills/corporate-events/SKILL.md
agent/src/skills/correlation-analysis/SKILL.md
agent/src/skills/correlation-regime/SKILL.md
agent/src/skills/cross-market-strategy/SKILL.md
agent/src/skills/crypto-derivatives/SKILL.md
agent/src/skills/data-routing/SKILL.md
agent/src/skills/defi-yield/SKILL.md
agent/src/skills/dividend-analysis/SKILL.md
agent/src/skills/doc-reader/SKILL.md
agent/src/skills/earnings-forecast/SKILL.md
agent/src/skills/earnings-revision/SKILL.md
agent/src/skills/eastmoney/SKILL.md
agent/src/skills/edgar-sec-filings/SKILL.md
agent/src/skills/elliott-wave/SKILL.md
agent/src/skills/event-driven/SKILL.md
agent/src/skills/execution-model/SKILL.md
agent/src/skills/factor-research/SKILL.md
agent/src/skills/fund-analysis/SKILL.md
agent/src/skills/fundamental-filter/SKILL.md
agent/src/skills/geopolitical-risk/SKILL.md
agent/src/skills/global-macro/SKILL.md
agent/src/skills/harmonic/SKILL.md
agent/src/skills/hedging-strategy/SKILL.md
agent/src/skills/hk-connect-flow/SKILL.md
agent/src/skills/ichimoku/SKILL.md
agent/src/skills/investor-lenses/SKILL.md
agent/src/skills/liquidation-heatmap/SKILL.md
agent/src/skills/macro-analysis/SKILL.md
agent/src/skills/market-microstructure/SKILL.md
agent/src/skills/minute-analysis/SKILL.md
agent/src/skills/ml-strategy/SKILL.md
agent/src/skills/multi-factor/SKILL.md
agent/src/skills/okx-market/SKILL.md
agent/src/skills/onchain-analysis/SKILL.md
agent/src/skills/options-advanced/SKILL.md
agent/src/skills/options-payoff/SKILL.md
agent/src/skills/options-strategy/SKILL.md
agent/src/skills/pair-trading/SKILL.md

Metadata

Files
0
Version
c546e87
Hash
05e0043a
Indexed
2026-07-24 17:46

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-21 07:55
浙ICP备14020137号-1