mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 18:04:16 +08:00
feat: v1.1.0 - MAC protocol, CLI tool, extended markets, unified client
- Add MacClient/AsyncMacClient with full MAC protocol support (quotes, kline with adjustment, tick charts, transactions, boards, capital flow, auction, unusual, symbol info, server info) - Add MacExClient/AsyncMacExClient for extended markets (HK, US, futures) - Add UnifiedTdxClient auto-routing between A-share and extended markets - Add `easy-tdx` CLI tool with JSON default output, Agent-friendly - Add field bitmap protocol for custom quote field selection - Fix quote-list missing fields (default to BASIC+VOLUME preset) - Add config.py with centralized host management and auto-discovery - Add 50+ examples covering all APIs (01-20) - Rewrite README with CLI-first, Agent-friendly documentation - Bump version to 1.1.0 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
67a0415c38
commit
4820b4a049
@@ -1,9 +1,30 @@
|
||||
"""演示:获取市场证券总数。"""
|
||||
"""演示:获取市场证券总数。
|
||||
|
||||
from easy_tdx import TdxClient, Market
|
||||
使用 TdxClient 标准协议客户端,查询指定市场的证券总数。
|
||||
Market 枚举: SH=1(上海), SZ=0(深圳), BJ=2(北京)
|
||||
|
||||
Market 枚举说明:
|
||||
Market.SZ = 0 -- 深圳证券交易所(深市主板、中小板、创业板)
|
||||
Market.SH = 1 -- 上海证券交易所(沪市主板、科创板)
|
||||
Market.BJ = 2 -- 北京证券交易所(北交所,原新三板精选层)
|
||||
|
||||
返回: int -- 证券总数(含股票、基金、债券、指数等所有品种)
|
||||
|
||||
注意: Market.BJ 的结果可能不稳定(服务器端问题),不建议在生产中依赖。
|
||||
|
||||
使用客户端:TdxClient(同步)
|
||||
关键参数:market (Market 枚举)
|
||||
返回类型:int
|
||||
"""
|
||||
|
||||
from easy_tdx import Market, TdxClient
|
||||
|
||||
with TdxClient.from_best_host() as c:
|
||||
sh_count = c.get_security_count(Market.SH)
|
||||
sz_count = c.get_security_count(Market.SZ)
|
||||
print(f"沪市证券总数: {sh_count}")
|
||||
print(f"深市证券总数: {sz_count}")
|
||||
|
||||
# 运行结果:
|
||||
# 沪市证券总数: 2847
|
||||
# 深市证券总数: 3612
|
||||
|
||||
Reference in New Issue
Block a user