mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 15:44:15 +08:00
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>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
ace1099ab0
commit
7fd6e610cf
@@ -0,0 +1,19 @@
|
||||
"""演示:获取个股当日资金流向(基于 L1 逐笔数据统计)。
|
||||
|
||||
资金分为四级: 超大(>100万)、大(20-100万)、中(4-20万)、小(<4万)。
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
from xmtdx import TdxClient, Market
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
flow = c.get_fund_flow(Market.SH, "600519")
|
||||
df = pd.DataFrame([
|
||||
{"级别": "超大单", "流入(亿)": flow.super_in / 1e8, "流出(亿)": flow.super_out / 1e8},
|
||||
{"级别": "大单", "流入(亿)": flow.large_in / 1e8, "流出(亿)": flow.large_out / 1e8},
|
||||
{"级别": "中单", "流入(亿)": flow.medium_in / 1e8, "流出(亿)": flow.medium_out / 1e8},
|
||||
{"级别": "小单", "流入(亿)": flow.small_in / 1e8, "流出(亿)": flow.small_out / 1e8},
|
||||
])
|
||||
df["净流入(亿)"] = df["流入(亿)"] - df["流出(亿)"]
|
||||
print("贵州茅台 当日资金流向:")
|
||||
print(df.to_string(index=False))
|
||||
Reference in New Issue
Block a user