taktiko

A股实时行情数据

数据分析v1.0.0
作者:taktiko更新于 2026-05-11a-share-real-time-data@clawhub_wangdinglu/a-share-real-time-data
网页抓取指标监控#Stock Market

据 AlphaMoat 统计,截至 2026-10,A股实时行情数据 累计下载 21,439 次、获 13 个星标,按累计下载量在本次参与排名的 10,914 个 AI 技能中排名第 1,315 位,在「数据分析」分类(915 个)中排名第 123 位。

列表默认按累计下载量排序,也可按星标排序;详情页排名按累计下载量计算。

累计下载
2.1万
星标
13
全站下载量排名
#1,315
全站前 13% · 「数据分析」前 14%
平台累计下载星标评论
ClawHub ↗5,4962-
SkillHub ↗2.1万13—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

可获取 K 线、实时报价与逐笔成交记录,也能判断当天是否为交易日、当前处于盘前盘中还是盘后。接口按北京时间交易时段设计,北京证券交易所不在支持范围内。 行情取决于上游连线与交易时段;不保证即时性,也不是投资建议。

资料发布于 2026-10-29

可以用来做什么

  • 取某只股票的分时与日线数据做复盘
  • 批量拉一批股票的实时报价

什么时候用

  • 需要 A 股行情或逐笔成交数据时
  • 要按交易时段判断是否该发起请求时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

拉这几只股票最近的日线数据
现在这个时间点能取实时报价吗,帮我确认交易状态

月度数据趋势

累计下载2.1万
3,0291.3万2.3万2026-03 · 累计下载 4,3932026-05 · 累计下载 6,9412026-06 · 累计下载 7,7232026-07 · 累计下载 8,5222026-08 · 累计下载 9,5092026-09 · 累计下载 1.1万2026-10 · 累计下载 2.1万26-0326-0926-10
星标13
18142026-03 · 星标 22026-05 · 星标 82026-06 · 星标 112026-07 · 星标 132026-08 · 星标 132026-09 · 星标 132026-10 · 星标 1326-0326-0926-10

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-102.1万—13
2026-091.1万—13
2026-089,509+11.6%13
2026-078,522+10.3%13
2026-067,723+11.3%11
2026-056,941—8
2026-034,393—2

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

8.1 KB · ClawHub v1.0.0
---
name: mootdx-china-stock-data
description: Fetch China A-share stock market data (bars, realtime quotes, tick-by-tick transactions) via mootdx/TDX protocol. Use when working with Chinese stock data, mootdx library, TDX quotes, intraday minute bars, transaction history, or real-time A-share market data.
---

# Mootdx China A-Share Stock Data Client

A wrapper around the `mootdx` library (TDX protocol) for fetching China A-share market data including K-line bars, real-time quotes, and tick-by-tick transaction records.

## Installation
展开全部(共 283 行)

```bash
pip install mootdx
```

> `mootdx` depends on `tdxpy` internally. Both are installed together.

### Verify & Demo

```bash
python scripts/setup_and_verify.py           # Install + verify + connectivity test
python scripts/setup_and_verify.py --check   # Verify only (skip install)
python scripts/setup_and_verify.py --demo    # Full API demo with real output
```

The `--demo` mode exercises every major API and prints real data — useful as a runnable reference for correct calling patterns.

## Critical: Time & Timezone Considerations

### Trading Hours (Beijing Time, UTC+8)

| Session | Time |
|---------|------|
| Morning | 09:30 - 11:30 (120 min) |
| Lunch break | 11:30 - 13:00 |
| Afternoon | 13:00 - 15:00 (120 min) |
| **Total** | **240 trading minutes/day** |

### Trading Time Bypass Patch

**Problem**: `mootdx` / `tdxpy` has a built-in `time_frame()` check that blocks API calls outside trading hours. On servers with non-Beijing timezone, this breaks even during valid trading hours.

**Solution**: Monkey-patch `tdxpy.hq.time_frame` to always return `True`:

```python
import tdxpy.hq
tdxpy.hq.time_frame = lambda: True
```

This patch is applied automatically during `MootdxClient.__init__()`. Without it, `transactions()` and `transaction()` calls will silently return empty results outside detected trading hours.

### Trading Calendar

When querying historical data, always check if a date is a trading day. Non-trading days (weekends, holidays) have no data. The client uses `TradingCalendarStrategy.is_trading_day(date_str)` for this — you must have a trading calendar service available.

### Date/Time Parameter Formats

| Parameter | Format | Example |
|-----------|--------|---------|
| `date` | `YYYYMMDD` | `"20250210"` |
| `time` | `HH:MM:SS` or `HH:MM` | `"10:30:00"` or `"10:30"` |

## Stock Code Format

mootdx uses **pure numeric codes** (TDX format). Convert from standard format:

| Standard Format | TDX Format | Market |
|----------------|------------|--------|
| `000001.SZ` | `000001` | Shenzhen |
| `600300.SH` | `600300` | Shanghai |
| `300750.SZ` | `300750` | Shenzhen (ChiNext) |
| `688001.SH` | `688001` | Shanghai (STAR) |

**Conversion**: Strip the `.SH` / `.SZ` / `.BJ` suffix.

> **Important**: mootdx does NOT support Beijing Stock Exchange (`.BJ`) stocks. Filter them out before calling.

## API Reference

### 1. Initialize Client

```python
from mootdx.quotes import Quotes
client = Quotes.factory(market='std')
```

### 2. `get_bars()` — K-Line / Candlestick Data

Fetch historical or real-time K-line bars.

```python
await client.get_bars(
    stock_code="000001.SZ",   # Standard format (auto-converted)
    frequency=7,               # K-line period (see table below)
    offset=240,                # Number of bars to fetch
    date="20250210",           # Optional: specific date (YYYYMMDD)
    time="10:30:00",           # Optional: specific time (HH:MM:SS)
    filter_by_time=True        # Filter to closest bar matching time
)
```

**Frequency codes:**

| Code | Period |
|------|--------|
| 7 | 1-minute bars |
| 8 | 1-minute bars (alternative) |
| 4 | Daily bars |
| 9 | Daily bars (alternative) |

**Return format** (list of dicts):

```python
{
    "stock_code": "000001.SZ",
    "datetime": "2025-02-10 10:30:00",
    "open": 12.50,
    "high": 12.65,
    "low": 12.45,
    "close": 12.60,
    "vol": 150000.0,
    "amount": 1890000.0
}
```

**Start position calculation**: For historical dates, the `start` parameter is calculated as the number of trading minutes (for 1-min bars) or trading days (for daily bars) between now and the target datetime. This accounts for:
- Whether today is a trading day
- Current trading session status (pre-market / in-session / post-market)
- Lunch break gap (11:30-13:00)

### 3. `get_realtime_quote()` — Single Stock Real-Time Quote

```python
await client.get_realtime_quote(stock_code="000001.SZ")
```

**Returns** (dict): Price, OHLC, volume, amount, and full Level-2 order book (5-level bid/ask):

```python
{
    "stock_code": "000001.SZ",
    "price": 12.60,
    "last_close": 12.50,
    "open": 12.45, "high": 12.65, "low": 12.40,
    "volume": 5000000, "amount": 63000000,
    "bid1": 12.59, "bid2": 12.58, ..., "bid5": 12.55,
    "ask1": 12.60, "ask2": 12.61, ..., "ask5": 12.65,
    "bid_vol1": 500, ..., "ask_vol5": 300,
    "pct_chg": 0.8
}
```

### 4. `get_realtime_quotes()` — Batch Real-Time Quotes

Native batch interface — much faster than looping `get_realtime_quote()`.

```python
await client.get_realtime_quotes(["000001.SZ", "600300.SH", "300750.SZ"])
```

**Returns** (list of dicts):

```python
{
    "stock_code": "000001.SZ",
    "trade_date": "2025-02-10",
    "open": 12.45, "high": 12.65, "low": 12.40, "close": 12.60,
    "pre_close": 12.50,
    "change": 0.15,
    "pct_chg": 1.2048,
    "vol": 5000000.0,
    "amount": 63000000.0,
    "is_realtime": true
}
```

> `pct_chg` is calculated from **today's open price**, not previous close.

### 5. `get_batch_bars()` — Batch K-Line Data

Parallel fetch K-line bars for multiple stocks with concurrency control.

```python
await client.get_batch_bars(
    stock_codes=["000001.SZ", "600300.SH"],
    date="20250210",
    time="10:30:00",
    max_concurrent=10
)
```

**Returns**: `Dict[str, List[Dict]]` — `{stock_code: [bar_data, ...]}`

### 6. `get_transactions_history()` — Historical Tick Data

Tick-by-tick transaction records for a specific historical date.

```python
await client.get_transactions_history(
    stock_code="000001.SZ",
    date="20250210",         # Required: YYYYMMDD
    start=0,
    offset=1000
)
```

**Returns** (list of dicts):

```python
{
    "stock_code": "000001.SZ",
    "time": "09:30:05",
    "price": 12.50,
    "vol": 100,
    "buyorsell": 0,          # 0=buy, 1=sell, 2=neutral
    "num": 5,                # Number of trades in this tick
    "volume": 100
}
```

### 7. `get_transactions_realtime()` — Real-Time Tick Data

Today's live tick-by-tick transaction stream.

```python
await client.get_transactions_realtime(
    stock_code="000001.SZ",
    start=0,
    offset=1000
)
```

Same return format as `get_transactions_history()`.

### 8. `get_transactions_with_fallback()` — Tick Data with Fallback

Tries real-time first, falls back to today's historical data if empty.

```python
await client.get_transactions_with_fallback(
    stock_code="000001.SZ",
    start=0, offset=1000,
    use_history_fallback=True
)
```

## Raw mootdx API (Low-Level)

If using `mootdx` directly without the wrapper:

```python
from mootdx.quotes import Quotes

client = Quotes.factory(market='std')

# K-line bars
df = client.bars(symbol="000001", frequency=7, start=0, offset=240)

# Real-time quotes (supports list of symbols for batch)
df = client.quotes(symbol="000001")
df = client.quotes(symbol=["000001", "600300"])

# Historical transactions
df = client.transactions(symbol="000001", start=0, offset=1000, date="20250210")

# Real-time transactions
df = client.transaction(symbol="000001", start=0, offset=1000)
```

> All raw APIs return **pandas DataFrames**.

## Common Pitfalls

1. **Empty results outside trading hours**: Apply the `time_frame` patch (see above)
2. **Beijing Exchange stocks**: `.BJ` codes are NOT supported — always filter them out
3. **Rate limiting**: Default rate limit is 0.005s between calls; adjust if connection drops
4. **Weekend/holiday queries**: Always validate against trading calendar before querying
5. **1-min bar offset calculation**: Must account for 240 trading minutes/day with lunch gap

## Additional Resources

- For detailed method signatures and time calculation logic, see [api-reference.md](api-reference.md)

「数据分析」分类下的热门技能

全能金融爬虫数据分析

中国金融机构数据爬取与分析综合 Skill v12.0.0。2334家/43大类机构名单、60+财经媒体源舆情、 A股报告/公告/研报、60+种查询多源金融数据(自动降级+缓存)、爬取调度与网页操作增强、 实时数据中枢、24 技术指标引擎、多源证据融合、110 MCP 工具 + 10 Resource + 14 Prompt。 🆕 v12.0.0 四条线(信息获取 / 打包下载 / 数据分析 / 登录): 编排:gather_info() 一次跑完"路由→抓取→去占位→质量分→能力边界→回执→打包", 8 类意图各带问法、输入输出、典型耗时与 not_for(说清哪件事做不了)。 诚实:反爬占位条目一律剔除并记账,空结果报 E_SOURCE_EMPTY,不把假数据判成 B 级成功。 交付:包内自带 manifest.json(逐文件 sha256),verify 查得出改动/缺失/多塞, 批量下载单条失败不中断整批,失败清单可直接只重下那几条。 登录:Cookie 由用户导出或扫码接管,档案化 + 健康度四档,对外输出全脱敏(值永不回显)。 何时触发:爬取机构、舆情爬取、东方财富、公告下载、实时行情、技术指标、统一查询、 交付包、批量重下、我已经登录了、登录态还有效吗(完整触发词见下方 auto_trigger)。

↓ 77.0万★ 288user_9d5a2a39
钢联AI - 智能问数数据分析

大宗商品价格数据查询技能。用于查询大宗商品期现货价格、宏观经济指标、产业链供需数据、进出口库存数据、金融市场数据等。当用户询问:(1) 期货/现货价格查询,如"螺纹钢价格"、"铜期货收盘价"; (2) 历史行情或趋势分析;(3) 区域或企业价格对比;(4) 宏观经济指标,如GDP、CPI;(5) 产业链上下游数据;(6) 多市场金融数据(期权、股票、债券、外汇);(7) 结算确认单生成时触发此技能。

↓ 70.5万★ 6u_9ed3401d
smart-charts数据分析

32种图表,3 个主题,2步生成: 1.上传数据 — 将 CSV / Excel / JSON 等格式的数据文件拖入对话框; 2.查看结果 — 交互式图表(HTML),可保存图表为图片.

↓ 60.5万★ 135user_5b28ea14
AdMapix数据分析

AdMapix 的取数层:把广告与应用相关的查询转成接口调用,只回原始 JSON。

↓ 57.5万★ 304fly0pants
论文配图一键生成数据分析

论文配图一键生成:一条命令从 JSON/CSV/Excel 生成顶刊级学术图表,科研绘图 与期刊配图全场景覆盖。40 种图表(森林图/KM 生存曲线(自动风险表)/竞争风险累计发生率/ROC/校准 曲线/决策曲线 DCA/列线图/RCS 非线性剂量反应/亚组分析森林图/RMST 限制平均生存时间/Galbraith 径向图/火山图/雨云图/山脊图/哑铃图/游泳图(逐例时长+里程碑)/ 肿瘤缓解瀑布图/UpSet 交集/PRISMA 流程图/漏斗/BA 一致性/PCA/热图/箱线/小提琴/ 组合图/Cox 多因素回归森林图等),9 套配色(含色盲安全 Okabe-Ito 与期刊色板),9 种期刊投稿预设, YAML 流水线一条命令出全套论文图,一次渲染多格式导出(TIFF/PNG/PDF), PDF 重叠门禁,600dpi。纯本地运行,数据不出机,中文零配置。适用:写论文/ 投稿要配图、把数据变成可投稿图表、批量重出全套图。不适用:文本润色/翻译/ 改写(请用写作类工具);商业报表/仪表盘/海报装饰;无数据支撑的纯示意图。

↓ 42.1万★ 83user_481397b5
smart-charts数据分析

Intelligent chart generation and data analysis skill. Reads user-supplied data files (CSV/Excel/JSON), analyzes data characteristics with LLM assistance, auto-recommends and generates interactive ECharts visualizations. Use when the user asks to analyze data, generate charts, create visualizations, or work with tabular data files.

↓ 25.7万★ 1user_814dbe54
股票/基金/期货量化分析工具数据分析

全球智能投研工具(stock-researcher)v13.0:多源数据 + 概率预测 + 可导出报告。 核心能力: - 多源数据路由:按市场/类别选源,逐级降级;每个结果标注来源与时效等级;源不可用时明确标 unavailable - 全资产量化:股票/ETF/场外基金/指数/期货(期限结构、基差、持仓、折溢价)多因子分析 - 概率预测:1d/5d/1M/3M/6M 经验分布 + 分位数 + 方向概率 + 区间,kNN 邻域收缩融合全局分布; 样本不足自动弃权,可按历史命中样本(同桶)做概率校准 - 证据链简报:每条结论绑定来源、时间与数据质量,冲突信号保留而不抹平 - 报告导出:Word/PPT/PDF/Markdown/JSON/纯文本,纯标准库渲染 + 可选第三方引擎 - MCP Server 24 工具,Claude Code 可直接调用;知识库 12 适配器双向同步 三条铁律: - 数据不装:拿不到就报不可用,不拿 0 价、不拿空表冒充 - 预测不装:概率来自历史相似条件的经验分布,样本不足就说不足,不硬给方向 - 评分≠盈利保证:任何结论都带免责声明

↓ 19.2万★ 147user_9d5a2a39
Tavily Search数据分析

走 Tavily 检索公开网页,返回带链接与摘要的结构化结果。

↓ 16.5万★ 286Xiaoran Li

数据月份:2026-10 · 下载/星标数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。