Skip to main content

Unified wrapper around pytdx-style market data APIs.

Project description

zsdtdx

zsdtdx 是一个面向 A 股/期货行情场景的 Python 封装库,基于 pytdx 体系做统一 API、连接池、重试与并行抓取增强,目标是提供更稳定的一致化数据接口。

安装

pip install zsdtdx

快速开始

import queue as py_queue
from zsdtdx import StockKlineTask, get_client, get_stock_kline, get_stock_latest_price

with get_client() as client:
    prices = get_stock_latest_price(["600000", "000001"])

    q = py_queue.Queue()
    payloads = get_stock_kline(
        task=[
            StockKlineTask(code="600000", freq="d", start_time="2026-02-01", end_time="2026-02-14"),
            {"code": "000001", "freq": "60", "start_time": "2026-02-01", "end_time": "2026-02-14"},
        ],
        queue=q,
        mode="sync",
    )

    print(prices)
    print(len(payloads))

配置说明

  • 默认情况下,get_client() 会读取包内置的 config.yaml
  • 你可以按需传入自定义配置路径:
from zsdtdx import get_client

with get_client(config_path=r"D:\\configs\\zsdtdx.yaml") as client:
    ...
  • 时间窗口按左闭右开 [start_time, end_time) 解释。
  • get_stock_kline 只接受 task 列表输入(StockKlineTaskdict)。

API 概览

  • get_client
  • get_supported_markets
  • get_stock_code_name
  • get_all_future_list
  • get_stock_kline
  • get_future_kline
  • get_company_info
  • get_stock_latest_price
  • get_future_latest_price
  • get_runtime_failures
  • get_runtime_metadata

运行环境与依赖

  • Python: >=3.10
  • 依赖:pandasPyYAMLsixpsutil

开发文档

以下文档用于开发维护,不作为对外安装说明主文档:

  • HANDOFF.md
  • PERFORMANCE_REPORT.md
  • examples/

许可证与来源

  • 本项目以 MIT 许可证发布,见 LICENSE
  • 本项目基于 pytdx 生态进行改写与扩展,归属说明见 THIRD_PARTY_NOTICES.md

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

zsdtdx-0.1.0.tar.gz (77.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zsdtdx-0.1.0-py3-none-any.whl (113.7 kB view details)

Uploaded Python 3

File details

Details for the file zsdtdx-0.1.0.tar.gz.

File metadata

  • Download URL: zsdtdx-0.1.0.tar.gz
  • Upload date:
  • Size: 77.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for zsdtdx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d31ab9b7561350be578b5d7159e314c1f7a1eb231248886ea95ca3d1984d7929
MD5 5f5c3f38ed0c7605537d826280a2de4c
BLAKE2b-256 b2b86a9d5bd3b1cd0854c14e4666c9ee9ffed39a05d464ac89fbce467a1c6e3c

See more details on using hashes here.

File details

Details for the file zsdtdx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zsdtdx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 113.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for zsdtdx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a68bcc8a931767866777434cf703e57a7f143a3f5c9b462c00bd9a0844017cb7
MD5 c8bc04ac6389ed3a71c6b89741b2ed84
BLAKE2b-256 60619f48f7f2cac5313d170586d7571104bd243e781ebac38d52bf224b9d1c50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page