Skip to main content

QuantSonar Python SDK

tests PyPI

官网 · API 文档 · 免费注册 · MCP 接入 · Agent Skill

QuantSonar 官方 Python SDK —— A 股行情、财务、资金流、筹码、龙虎榜,38 个数据接口,一个 API Key 全部拿到。

安装

pip install quantsonar

快速开始

import quantsonar as qs

qs.set_token("qs_你的密钥")   # 免费注册: https://quantsonar.com/register

# 贵州茅台 2026 年以来的日线(返回 pandas.DataFrame)
df = qs.daily(symbol="600519.SH", start_date="20260101")

# 每日指标 / 财务 / 资金流 / 龙虎榜……全部同一姿势
qs.fundamentals(symbol="600519.SH", trade_date="20260710")
qs.income(symbol="600519.SH", period="20251231")
qs.moneyflow(trade_date="20260710")
qs.top_list(trade_date="20260710")

# 指数与外汇(命名对齐 Tushare 习惯)
qs.index_daily(symbol="000300.SH", start_date="20260101")
qs.fx_daily(start_date="20260101")

# 实时行情与快讯
qs.realtime(symbol="600519.SH,300750.SZ")
qs.news_flash(source="cls")
  • Key 也可以放环境变量 QUANTSONAR_TOKEN,省去 set_token
  • 全部接口一览:qs.endpoints()(方法名 / 路径 / 中文说明)
  • 参数与返回字段和 在线文档 一一对应;日期统一 YYYYMMDD,证券代码带交易所后缀(600519.SH)

错误处理

from quantsonar import QuantSonarError, RateLimitError

try:
    df = qs.daily(symbol="600519.SH")
except RateLimitError as e:      # 超出限速(429)
    print(e, "建议等待:", e.retry_after, "秒")
except QuantSonarError as e:     # 其他错误,中文说明
    print(e.status, e)

多账号 / 自定义

from quantsonar import QuantSonar

client = QuantSonar(token="qs_另一把密钥", timeout=60)
df = client.daily(symbol="000001.SZ", start_date="20260101")

定价

免费 100 次/天,无需信用卡。付费档全部数据不分级,只按调用量计费 —— 定价页。

Metadata

Release files for quantsonar 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quantsonar 0.1.1
File Size Uploaded
quantsonar-0.1.1.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for quantsonar 0.1.1
File Interpreter ABI Platform
quantsonar-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.1 kB

Release files / quantsonar-0.1.1.tar.gz

Download URL quantsonar-0.1.1.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
97f76c33c0818346500592a7f08f75618cb68291a75722fa972fffe1d2b710ac
BLAKE2b-256 checksum
How to use checksums
a5b9c505192bd78520e384ce52915ebef7b3076189cd7828bbcc57522294d85d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release files / quantsonar-0.1.1-py3-none-any.whl

Download URL quantsonar-0.1.1-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e08d44bbb02ee87574923a1752e49415e3bb162d2e14f3610cc5b4e85e000ee
BLAKE2b-256 checksum
How to use checksums
fc00143e5bc06ceee4e65a655d36bc56b16e7ccafbbdbf9a31130ca0563805d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page