mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 18:04:16 +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>
16 lines
622 B
Python
16 lines
622 B
Python
"""演示:获取个股历史日线资金流向序列。"""
|
|
|
|
import pandas as pd
|
|
from xmtdx import TdxClient, Market
|
|
|
|
with TdxClient.from_best_host() as c:
|
|
flows = c.get_history_fund_flow(Market.SH, "600519", 0, 10)
|
|
df = pd.DataFrame([{
|
|
"日期": f"{f.year}-{f.month:02d}-{f.day:02d}",
|
|
"超大单净流入(亿)": (f.super_in - f.super_out) / 1e8,
|
|
"大单净流入(亿)": (f.large_in - f.large_out) / 1e8,
|
|
"主力净流入(亿)": f.main_net_inflow / 1e8,
|
|
} for f in flows])
|
|
print(f"贵州茅台 历史资金流向,共 {len(df)} 天:")
|
|
print(df.to_string(index=False))
|