Files
easy-tdx/examples/04_minute/minute_time_data.py
T
GitHubandClaude Opus 4.7 7fd6e610cf feat: add examples (01-08), fix index bars parsing, add ruff hook
- 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>
2026-05-21 18:36:50 +08:00

15 lines
451 B
Python

"""演示:获取今日分时数据(240 条)。"""
import pandas as pd
from xmtdx import TdxClient, Market
with TdxClient.from_best_host() as c:
bars = c.get_minute_time_data(Market.SH, "600000")
df = pd.DataFrame([{
"序号": i + 1,
"价格": bar.price,
"成交量": bar.vol,
} for i, bar in enumerate(bars)])
print(f"浦发银行今日分时,共 {len(df)} 条:")
print(df.to_string(index=False))