Files
easy-tdx/examples/05_transaction/history_transaction.py
T
GitHubandClaude Opus 4.7 50491f9aae feat!: rename project from xmtdx to easy-tdx
- Package directory: src/xmtdx/ -> src/easy_tdx/
- Import path: from easy_tdx import ...
- pip install easy-tdx
- Add LICENSE (MIT) with upstream attribution (pytdx, xmtdx)
- Add NOTICE with detailed attribution
- Update all examples, tests, scripts, docs
- Bump version to 1.0.0

BREAKING CHANGE: import path changed from `xmtdx` to `easy_tdx`

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 23:21:21 +08:00

17 lines
602 B
Python

"""演示:获取历史逐笔成交数据。date 参数为 YYYYMMDD 格式的整数。"""
import pandas as pd
from easy_tdx import TdxClient, Market
with TdxClient.from_best_host() as c:
date = 20250110
records = c.get_history_transaction_data(Market.SH, "600000", date, 0, 20)
df = pd.DataFrame([{
"时间": f"{r.hour:02d}:{r.minute:02d}",
"成交价": r.price,
"成交量": r.vol,
"方向": "买" if r.buyorsell == 0 else "卖",
} for r in records])
print(f"浦发银行 {date} 最近 {len(df)} 笔成交:")
print(df.to_string(index=False))