# Mootdx

Mootdx A-share market data via TCP-direct 通达信 servers.

- Repository: https://github.com/HKUDS/Vibe-Trading (37375 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add HKUDS/Vibe-Trading --skill mootdx -g -a claude-code -y`
Codex: `npx skills add HKUDS/Vibe-Trading --skill mootdx -g -a codex -y`
Cursor: `npx skills add HKUDS/Vibe-Trading --skill mootdx -g -a cursor -y`
Gemini CLI: `npx skills add HKUDS/Vibe-Trading --skill mootdx -g -a gemini-cli -y`

## 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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

> **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.

- GitHub: https://github.com/mootdx/mootdx
- Legacy SDK installation (not needed for automatic A-share data): `pip install mootdx && pip install 'httpx>=0.28.1'`

> 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

```python
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

The rest: https://github.com/HKUDS/Vibe-Trading/blob/HEAD/agent/src/skills/mootdx/SKILL.md
