HTTP SDK for querying pipeline data service
Project description
qgdata Python SDK
定位
qgdata 是 qgdata-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/sort(asc、desc) - 参数语义由服务端解释
异常处理
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.6.tar.gz
(6.1 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 qgdata-0.1.6.tar.gz.
File metadata
- Download URL: qgdata-0.1.6.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0e8f55557917a3bc9daf6c46399dfb002d5fad9166375f857540f1c1e93d211
|
|
| MD5 |
c6b7d340928485390009b25993674016
|
|
| BLAKE2b-256 |
21c8297e9613ea1202f6e1a9649513d9468f98cdabdb04b59a21b713ecf58949
|
File details
Details for the file qgdata-0.1.6-py3-none-any.whl.
File metadata
- Download URL: qgdata-0.1.6-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cd124a92e3a94bc63f1b2f40d24c2530702093d3621c56487dc5d6548d8d267
|
|
| MD5 |
c192f62032322913217f071364f056ee
|
|
| BLAKE2b-256 |
fab80b75e442484108accf3b0268512059dc0257f32865b81c776c70d9eff78f
|