通达信数据读取接口
运行环境
- 操作系统: Windows / MacOS / Linux 都可以运行.
- Python: 3.8 以及以上版本.
安装方法
新手建议使用
pip install -U 'mootdx2[all]'安装
PIP 安装方法
pip install mootdx2
升级安装
pip install -U mootdx2
开发环境安装
推荐使用 uv 进行开发环境管理:
# 安装 uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# 克隆代码
git clone https://github.com/mootdx/mootdx.git
cd mootdx
# 同步依赖
uv sync
# 运行测试
uv run pytest
使用说明
以下只列举一些例子, 详细说明请查看在线文档: https://www.mootdx.com
通达信离线数据读取
from mootdx2.reader import Reader
# market 参数 std 为标准市场(就是股票), ext 为扩展市场(期货,黄金等)
# tdxdir 是通达信的数据目录, 根据自己的情况修改
reader = Reader.factory(market='std', tdxdir='C:/new_tdx')
# 读取日线数据
reader.daily(symbol='600036')
# 读取分钟数据
reader.minute(symbol='600036')
# 读取时间线数据
reader.fzline(symbol='600036')
通达信线上行情读取
from mootdx2.quotes import Quotes
# 标准市场
client = Quotes.factory(market='std', multithread=True, heartbeat=True)
# k 线数据
client.bars(symbol='600036', frequency=9, offset=10)
# 指数
client.index(symbol='000001', frequency=9)
# 分钟
client.minute(symbol='000001')
通达信财务数据读取
from mootdx2.affair import Affair
# 远程文件列表
files = Affair.files()
# 下载单个
Affair.fetch(downdir='tmp', filename='gpcw19960630.zip')
# 下载全部
Affair.parse(downdir='tmp')
M1 mac 系统PyMiniRacer不能使用,访问: https://github.com/sqreen/PyMiniRacer/issues/143
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mootdx2-1.0.5.tar.gz
(11.6 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
mootdx2-1.0.5-py3-none-any.whl
(108.6 kB
view details)
File details
Details for the file mootdx2-1.0.5.tar.gz.
File metadata
- Download URL: mootdx2-1.0.5.tar.gz
- Upload date:
- Size: 11.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a9df4b79e1d98c16286098d27bcb2453348d23e097fcdb885eb2738dfe9eb54
|
|
| MD5 |
25ccf1ad0bd77e8f982b80cc22762a58
|
|
| BLAKE2b-256 |
c6027a235508de6ced9337146f5b7be7916af73167f541d7931787ebf873cd6f
|
File details
Details for the file mootdx2-1.0.5-py3-none-any.whl.
File metadata
- Download URL: mootdx2-1.0.5-py3-none-any.whl
- Upload date:
- Size: 108.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8c9948c2234e7cdc29cb141522866a140ff90776a1fa766dbf0268bd76c6196
|
|
| MD5 |
113b2826bf3221751fdf47f1977c715b
|
|
| BLAKE2b-256 |
110ddfe44d04de69ee13eebecfd69de738c196891438535c625887beafabb5f6
|