Files
easy-tdx/examples/05_transaction/history_transaction.py
T
Justin Gu 00825eb24a feat: merge datetime fields in DataFrame output, hide MinuteBar internal fields
- K-line: daily+ periods output 'date' only, minute periods output 'datetime'
- Transactions (tick-by-tick): combine date param + hour/minute into 'datetime'
- XdxrRecord, HistoricalFundFlow: year/month/day merged to 'date'
- MinuteBar: rename unknown_1 to _unknown_1 (hidden from DataFrame)
- MinuteBar: add datetime column computed from bar index (A-share 240-bar pattern)
- get_minute_time_data: use history endpoint only (current-day endpoint broken in pytdx too)
- Update all examples to reflect new DataFrame column names
2026-05-22 04:19:07 +08:00

11 lines
496 B
Python

"""演示:获取历史逐笔成交数据。date 参数为 YYYYMMDD 格式的整数。"""
from easy_tdx import Market, TdxClient
with TdxClient.from_best_host() as c:
date = 20250110
df = c.get_history_transaction_data(Market.SH, "600000", date, 0, 20)
df["方向"] = df["buyorsell"].map({0: "买", 1: "卖", 2: "中性", 8: "集合竞价"})
print(f"浦发银行 {date} 最近 {len(df)} 笔成交:")
print(df[["datetime", "price", "vol", "方向"]].to_string(index=False))