Files
easy-tdx/examples/02_market_info/market_stat.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

20 lines
647 B
Python

"""演示:获取全市场涨跌统计概况。"""
import pandas as pd
from easy_tdx import TdxClient
with TdxClient.from_best_host() as c:
stat = c.get_market_stat()
df = pd.DataFrame([{
"上涨": stat.up_count,
"下跌": stat.down_count,
"平盘": stat.neutral_count,
"停牌(估算)": stat.suspended_count,
"总计": stat.total_count,
"成交额(亿)": round(stat.total_amount / 1e8, 2),
"总市值(万亿)": round(stat.total_market_cap / 1e12, 4),
"涨停": stat.limit_up_count,
"跌停": stat.limit_down_count,
}])
print(df.T.to_string(header=False))