Skip to main content

QuantSonar A 股量化数据 API 官方 Python SDK:行情、财务、资金流、龙虎榜,一个 Key 全部拿到

Project description

QuantSonar Python SDK

tests PyPI

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 次/天,无需信用卡。付费档全部数据不分级,只按调用量计费 —— 定价页

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

quantsonar-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

quantsonar-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: quantsonar-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for quantsonar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a92aa6be6e488b2b5d1ff5b2926f1c8c57d53e2a3ae8ed31a52886c97d19eb53
MD5 430e952db9b54963af56544ed6a8ec71
BLAKE2b-256 c03d227b236eaba0138bb739cbdfc8e2f126e038a6d188a43de0a0744c697a49

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantsonar-0.1.0.tar.gz:

Publisher: publish.yml on QuantSonar/quantsonar-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: quantsonar-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for quantsonar-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2bb3d92f0cc91a1ae6f739c4e01331fcf9c581c270a87dc3ff0a9af6798fd08
MD5 a20a5692fa8390c80621d21a7c3dfbea
BLAKE2b-256 6e7344e7fd6ab91f8bfc94acd38983f69aaf8df551beb121e638c4ab75d50cec

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantsonar-0.1.0-py3-none-any.whl:

Publisher: publish.yml on QuantSonar/quantsonar-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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