mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 21:34:21 +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>
24 lines
630 B
Python
24 lines
630 B
Python
"""演示:计算个股涨跌停价格。"""
|
|
|
|
import pandas as pd
|
|
from easy_tdx import TdxClient, Market
|
|
|
|
CODE = "600519"
|
|
NAME = "贵州茅台"
|
|
|
|
with TdxClient.from_best_host() as c:
|
|
quotes = c.get_security_quotes([(Market.SH, CODE)])
|
|
if quotes:
|
|
q = quotes[0]
|
|
limit_up, limit_down = c.get_price_limits(
|
|
Market.SH, CODE, NAME, q.pre_close
|
|
)
|
|
df = pd.DataFrame([{
|
|
"代码": CODE,
|
|
"名称": NAME,
|
|
"昨收": q.pre_close,
|
|
"涨停价": limit_up,
|
|
"跌停价": limit_down,
|
|
}])
|
|
print(df.to_string(index=False))
|