A Python SDK for real-time stock and futures market data
Project description
TickHub Python SDK
面向股票、期货等金融数据用户提供实时市场股票信息的 Python SDK
如何使用
import tickhub
# 创建客户端(传入你的 API Token)
pro = tickhub.pro("your-tickhub-token")
# 获取日线数据
df = pro.get_daily(
ts_code='000001.SZ',
start_date='20240101',
end_date='20240301'
)
print(df)
# 获取实时行情
df = pro.rt_k(ts_code='000001.SZ')
print(df)
开发
环境要求
- Python 3.7+
开发依赖
| 工具 | 用途 |
|---|---|
| pytest | 测试框架 |
| pytest-cov | 测试覆盖率 |
| black | 代码格式化 |
| ruff | 代码检查 |
| build | 构建包 |
| twine | 发布到 PyPI |
本地开发
# 克隆仓库
git clone <repository-url>
cd tickhub
# 安装开发依赖
pip install -e ".[dev]"
# 或者手动安装
pip install -e .
pip install pytest pytest-cov black ruff twine build
# 设置 API Token(复制 .env.example 为 .env 并填入真实 token)
cp .env.example .env
# 编辑 .env 文件,将 your-api-token 替换为你的真实 token
# 运行测试
pytest
# 运行示例(需要 token)
python main.py
# 格式化代码
black tickhub/ tests/
# 代码检查
ruff check tickhub/ tests/
# 构建发布
python -m build
文档
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tickhub-0.1.0.tar.gz
(7.6 kB
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
File details
Details for the file tickhub-0.1.0.tar.gz.
File metadata
- Download URL: tickhub-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c115729752a466bc3638b243b30823b4961ac204ced7e409db148ef2dcd5cf18
|
|
| MD5 |
3f007e6de3fc8f7bc53a807853cf6971
|
|
| BLAKE2b-256 |
03b8a934dabe15d93e62d250b61c29b0d0f1c024f0d98733d73669ddc431941b
|
File details
Details for the file tickhub-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tickhub-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90a4d30629b7ee98ab820986c99c51f2cb6671f620f77daaa9a91ad4e21bd489
|
|
| MD5 |
9218df7e21c4ff37182c383f0327116f
|
|
| BLAKE2b-256 |
f77f893e56f8f24d52589334d03b106cf2e8a6f475a9cb6e44977951051744a8
|