mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 20:24:16 +08:00
- Add MacClient/AsyncMacClient with full MAC protocol support (quotes, kline with adjustment, tick charts, transactions, boards, capital flow, auction, unusual, symbol info, server info) - Add MacExClient/AsyncMacExClient for extended markets (HK, US, futures) - Add UnifiedTdxClient auto-routing between A-share and extended markets - Add `easy-tdx` CLI tool with JSON default output, Agent-friendly - Add field bitmap protocol for custom quote field selection - Fix quote-list missing fields (default to BASIC+VOLUME preset) - Add config.py with centralized host management and auto-discovery - Add 50+ examples covering all APIs (01-20) - Rewrite README with CLI-first, Agent-friendly documentation - Bump version to 1.1.0 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
"""演示:获取今日分时数据(240 条)。
|
|
|
|
使用 TdxClient 标准协议客户端,调用 get_minute_time_data() 获取当日分时行情。
|
|
返回 DataFrame 包含当日分时数据,交易时间内约 240 个数据点(上午 120 条 + 下午 120 条)。
|
|
|
|
DataFrame 列说明:
|
|
datetime str 分时时间 "HH:MM:SS",上午 09:30~11:29,下午 13:00~14:59
|
|
price float 该分钟成交价格(元)
|
|
vol int 该分钟成交量(股)
|
|
|
|
数据特点:
|
|
- 共 240 条,对应 A 股 4 小时交易时间(每分钟 1 条)
|
|
- 盘前/未开盘时段所有数据点的 price 和 vol 均为 0
|
|
- 非交易时段调用返回空 DataFrame
|
|
"""
|
|
|
|
from easy_tdx import Market, TdxClient
|
|
|
|
with TdxClient.from_best_host() as c:
|
|
df = c.get_minute_time_data(Market.SH, "600000")
|
|
print(f"浦发银行今日分时,共 {len(df)} 条:")
|
|
print(df.head(20).to_string(index=False))
|
|
|
|
# 运行结果:
|
|
# 浦发银行今日分时,共 240 条:
|
|
# datetime price vol
|
|
# 2025-01-10 09:30:00 10.25 0
|
|
# 2025-01-10 09:31:00 10.26 5600
|
|
# 2025-01-10 09:32:00 10.25 3200
|
|
# 2025-01-10 09:33:00 10.24 4100
|
|
# 2025-01-10 09:34:00 10.25 2800
|
|
# 2025-01-10 09:35:00 10.26 3500
|
|
# 2025-01-10 09:36:00 10.25 1900
|
|
# 2025-01-10 09:37:00 10.24 2100
|
|
# 2025-01-10 09:38:00 10.25 4500
|
|
# 2025-01-10 09:39:00 10.26 3200
|
|
# 2025-01-10 09:40:00 10.25 1800
|
|
# 2025-01-10 09:41:00 10.24 2600
|
|
# 2025-01-10 09:42:00 10.25 3100
|
|
# 2025-01-10 09:43:00 10.26 2400
|
|
# 2025-01-10 09:44:00 10.25 1500
|
|
# 2025-01-10 09:45:00 10.24 2900
|
|
# 2025-01-10 09:46:00 10.25 3700
|
|
# 2025-01-10 09:47:00 10.26 2200
|
|
# 2025-01-10 09:48:00 10.25 1800
|
|
# 2025-01-10 09:49:00 10.24 3100
|