mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 13:24:15 +08:00
- 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>
26 lines
801 B
Python
26 lines
801 B
Python
"""演示:批量获取实时五档行情。最多支持 80 只/次。"""
|
|
|
|
import pandas as pd
|
|
from easy_tdx import TdxClient, Market
|
|
|
|
with TdxClient.from_best_host() as c:
|
|
stocks = [
|
|
(Market.SH, "600000"), # 浦发银行
|
|
(Market.SH, "600519"), # 贵州茅台
|
|
(Market.SZ, "000001"), # 平安银行
|
|
(Market.SZ, "000858"), # 五粮液
|
|
]
|
|
quotes = c.get_security_quotes(stocks)
|
|
df = pd.DataFrame([{
|
|
"代码": q.code,
|
|
"现价": q.price,
|
|
"涨跌幅%": (q.price - q.pre_close) / q.pre_close * 100,
|
|
"今开": q.open,
|
|
"最高": q.high,
|
|
"最低": q.low,
|
|
"昨收": q.pre_close,
|
|
"成交量(手)": q.vol,
|
|
"成交额": q.amount,
|
|
} for q in quotes])
|
|
print(df.to_string(index=False))
|