mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 18:04:16 +08:00
feat: 增加板块信息(block_info)获取与解析功能
1. 核心模型:增加 TdxBlock dataclass。 2. 协议命令:实现 GetBlockInfoMetaCmd 与 GetBlockInfoCmd。 3. 编解码器:增加 codec/block.py,支持 .dat 板块文件二进制解析。 4. 客户端 API:TdxClient 和 AsyncTdxClient 增加 get_block_info(),支持分片拉取。 5. 测试与验证:增加单元测试 tests/unit/test_block_info.py 及实测脚本。 6. 文档更新:README.md 同步 API 及安装说明。
This commit is contained in:
@@ -17,6 +17,8 @@ pytdx 年久失修:多处已知解析 bug、Python 2 包袱、无类型注解
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -e . # 开发模式
|
||||
pip install -e ".[dev]" # 含测试/类型检查工具
|
||||
pip install -e ".[pandas]" # 含 pandas(可选)
|
||||
@@ -102,6 +104,7 @@ client = AsyncTdxClient.from_best_host(ping_timeout=5.0)
|
||||
| `get_finance_info(market, code)` | 最新财务数据 |
|
||||
| `get_company_info_category(market, code)` | 公司信息文件目录 |
|
||||
| `get_company_info_content(market, code, filename, offset, length)` | 公司信息文本 |
|
||||
| `get_block_info(filename)` | 板块信息(行业、概念、风格等) |
|
||||
|
||||
`AsyncTdxClient` 提供与同步版对应的查询方法与高可用入口,均为 `async def`。
|
||||
单个 `AsyncTdxClient` 仅维护一条 TCP 连接;并发调用会在连接内串行执行。
|
||||
@@ -181,8 +184,15 @@ _raw
|
||||
name filename start length
|
||||
```
|
||||
|
||||
### TdxBlock(板块信息)
|
||||
|
||||
```
|
||||
name category count codes
|
||||
```
|
||||
|
||||
## 修复的 pytdx Bug
|
||||
|
||||
|
||||
| # | 位置 | 问题 | 修复 |
|
||||
|---|------|------|------|
|
||||
| 1 | `xdxr_info` | 循环内始终读 `body[:7]`,所有记录字段相同 | 改为从当前 `pos` 读取,pos 正确推进 |
|
||||
|
||||
Reference in New Issue
Block a user