mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 15:44:15 +08:00
- Add example scripts for all API categories (connection, market info, kline, minute, transaction, finance, block, fund flow) - Fix GetIndexBarsCmd: index bar records have 4 extra bytes (advance/ decline counts) that were not consumed, causing pos drift and corrupted dates/volumes for all records after the first - Fix price_limits.py example (SecurityQuote has no name attr) - Fix finance_info.py display (scientific notation -> formatted numbers) - Add PostToolUse ruff hook (scripts/ruff_hook.py) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
17 lines
599 B
Python
17 lines
599 B
Python
"""演示:获取历史逐笔成交数据。date 参数为 YYYYMMDD 格式的整数。"""
|
|
|
|
import pandas as pd
|
|
from xmtdx 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))
|