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.
- GitHub: https://github.com/mootdx/mootdx
- Install:
pip install mootdx && pip install 'httpx>=0.28.1'
Mootdx pins
httpx<0.26insetup.py, but only uses basichttpx.Client/getAPIs that are forward-compatible. The secondpip installrestores 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 |
…