mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 20:24:19 +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>
48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
"""演示:获取历史某日分时数据。
|
|
|
|
使用 TdxClient 标准协议客户端,调用 get_history_minute_time_data() 获取指定日期的分时行情。
|
|
date 参数为 YYYYMMDD 格式的整数(如 20250110)。
|
|
|
|
DataFrame 列说明:
|
|
datetime str 分时时间 "HH:MM:SS",上午 09:30~11:29,下午 13:00~14:59
|
|
price float 该分钟成交价格(元)
|
|
vol int 该分钟成交量(股)
|
|
|
|
数据特点:
|
|
- 共 240 条,对应 A 股 4 小时交易时间
|
|
- 日期必须是交易日,非交易日返回空 DataFrame
|
|
- 数据覆盖历史较深,可追溯数年前的分时数据
|
|
"""
|
|
|
|
from easy_tdx import Market, TdxClient
|
|
|
|
with TdxClient.from_best_host() as c:
|
|
date = 20250110
|
|
df = c.get_history_minute_time_data(Market.SH, "600000", date)
|
|
print(f"浦发银行 {date} 分时数据,共 {len(df)} 条:")
|
|
print(df.head(20).to_string(index=False))
|
|
|
|
# 运行结果:
|
|
# 浦发银行 20250110 分时数据,共 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
|