Skip to main content

HTTP SDK for querying pipeline data service

Project description

qgdata Python SDK

定位

qgdataqgdata-http-service 的 Python 客户端,提供接近 Tushare 的调用体验,返回 pandas.DataFrame

安装

pip install qgdata

快速开始

import qgdata as qg

qg.set_token("your-token")
pro = qg.pro_api()

df = pro.stock_basic(
    fields="ts_code,name,list_date",
    order_by="list_date",
    sort="desc",
    limit=20,
)
print(df.head())

详细的用户接口文档见:docs/SDK_USER_API.md。 分钟行情专版文档见:docs/SDK_USER_API_STK_MINS.md

核心接口

统一查询:

df = pro.query(
    "stock_basic",
    ts_code="000001.SZ",
    fields=["ts_code", "name", "list_date"],
    order_by="list_date",
    sort="desc",
    limit=200,
    offset=0,
)

动态方法(等价于 query):

df = pro.stock_basic(ts_code="000001.SZ", limit=50)

获取 API 列表:

apis = pro.list_apis(enabled_only=True)

核心能力

  • set_token() + pro_api() 初始化
  • pro.query(...) 统一查询
  • pro.xxx(...) 动态 API 调用
  • pro.list_apis(...) 拉取可用接口

参数约定

  • 支持普通参数和列表参数
  • 支持分页:limit / offset
  • 支持排序:order_by / sortascdesc
  • 参数语义由服务端解释

异常处理

HTTP 或业务错误会抛出 PipelineSDKError

from qgdata import PipelineSDKError

try:
    df = pro.query("stock_basic", limit=10)
except PipelineSDKError as exc:
    print("message:", exc)
    print("code:", exc.code)
    print("detail:", exc.detail)

常见错误消息:

  • unauthorized(401)
  • 其它服务端 message(统一透传)

开发与发布

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*

更多发布步骤:docs/PYPI_PUBLISH.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

qgdata-0.1.5.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

qgdata-0.1.5-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file qgdata-0.1.5.tar.gz.

File metadata

  • Download URL: qgdata-0.1.5.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for qgdata-0.1.5.tar.gz
Algorithm Hash digest
SHA256 35a71293835859a003f7b9cf3d2470b7dff57dbf8c64a44827891a90bbd11b62
MD5 7e3ec93aba84033ba74e09edfec3a196
BLAKE2b-256 76259bbcebd34b9c345e965f7cc8eac6a048a11c8dcf155cbdd987da28fd10de

See more details on using hashes here.

File details

Details for the file qgdata-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: qgdata-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for qgdata-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a059b55b7d5111cfa0a9f1f15a9cc9a06ec29b9b057026905d3d77fd1184d99e
MD5 c0340e2459af23a2569092505db59b2e
BLAKE2b-256 374f606f3b51b6b98bb37a6b8b86f20e8db1342a045844bf8e306f68fe0daa54

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