Skip to main content

LiteQuant Python SDK

LiteQuant Python SDK 用于在本地下载和读取 LiteQuant 数据。SDK 会自动处理连接、同步、本地 Parquet 缓存和常见错误提示。

支持 Python 3.8 及以上版本。

Installation

pip install litequant

Quick Start

from litequant import LiteQuantClient

client = LiteQuantClient(
    api_token="your_api_token",
    save_path="./litequant_data",
)

client.UpdateAllCategory(update_method="incremental")
df = client.GetCategory("cn_stock_pivot#open")
print(df.tail())

client.close()

推荐使用上下文管理器自动关闭连接:

from litequant import LiteQuantClient

with LiteQuantClient(api_token="your_api_token", save_path="./litequant_data") as client:
    categories = client.ListCategories()
    df = client.GetCategory(categories[0])

默认 API 地址为 https://www.litequant.pro。如需连接测试环境,可以传入 api_url 或设置环境变量 LITEQUANT_API_URL

Transport Security

  • API Token 只会发送到 HTTPS 地址;仅允许 localhost127.0.0.1::1 使用 HTTP 本地调试。
  • SDK 不跟随 API 重定向,避免临时连接凭证被转发到其他地址。
  • 第三方 API 返回的外部明文 Redis/Tair 连接会被拒绝;官方生产 API 仅可在服务端明确声明受限传输策略、目标地址和端口均匹配时使用短期连接凭证。
  • 远端数据写入本地前必须通过 SHA-256 校验;不完整或异常元数据会被拒绝。
  • 数据类别名称会经过严格校验,不能越过 save_path 读写或删除文件。

Windows wheel 会将连接与同步核心编译为 .pyd,不随包分发对应的 Python 源文件。这可以提高查看和修改内部实现的门槛,但不应被视为不可逆向的安全边界;长期密钥和权限判断始终保留在服务端。

Error Handling

SDK 默认会在 Python 终端输出功能面错误提示,同时抛出类型化异常。错误信息不会展示后端细节。

from litequant import LiteQuantClient, LiteQuantError

try:
    with LiteQuantClient(api_token="your_api_token", save_path="./litequant_data") as client:
        df = client.GetCategory("cn_stock_pivot#open")
except LiteQuantError as exc:
    print(exc.code)
    print(exc.user_message)
    print(exc.retryable)

如果你希望完全自己处理错误提示,可以关闭终端输出:

client = LiteQuantClient(
    api_token="your_api_token",
    save_path="./litequant_data",
    display_errors=False,
)

常见公开错误码:

  • AUTH_INVALID:API 凭证无效或已过期
  • ACCOUNT_UNAVAILABLE:账号不可用
  • SUBSCRIPTION_UNAVAILABLE:套餐不可用或已过期
  • PERMISSION_DENIED:权限不足
  • CONNECTION_LIMIT:连接数已达上限
  • CONNECTION_INTERRUPTED:连接已中断,请重新连接
  • REQUEST_INVALID:请求参数无效
  • SERVICE_UNAVAILABLE:服务暂时不可用
  • DATA_UNAVAILABLE:数据暂时不可用
  • DATA_VERIFY_FAILED:数据校验失败

Data Cache

SDK 会把数据保存为本地 Parquet 缓存。再次读取同一数据类别时,会优先使用本地缓存;如果本地没有该数据类别,SDK 会自动同步。

当前 pivot 数据支持 monthlydaily 两种分区模式。后续可以在服务端元信息和客户端缓存层一起扩展更多分区模式。

Metadata Contract

数据服务会提供客户端可识别的类别列表、类别元信息和分区元信息。客户端会自动读取这些元信息并完成数据同步。

公开稳定字段包括:

  • partition_mode:pivot 分区模式,目前支持 monthlydaily
  • partition_keys:数据分区标识列表
  • hash:数据校验值
  • key_columns / dedupe_keys:unstack 数据去重键

普通用户通常不需要直接使用这些字段。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

litequant-3.0.4-cp314-cp314-win_amd64.whl (164.3 kB view details)

Uploaded CPython 3.14Windows x86-64

litequant-3.0.4-cp313-cp313-win_amd64.whl (162.0 kB view details)

Uploaded CPython 3.13Windows x86-64

litequant-3.0.4-cp312-cp312-win_amd64.whl (161.4 kB view details)

Uploaded CPython 3.12Windows x86-64

litequant-3.0.4-cp311-cp311-win_amd64.whl (166.7 kB view details)

Uploaded CPython 3.11Windows x86-64

litequant-3.0.4-cp310-cp310-win_amd64.whl (165.3 kB view details)

Uploaded CPython 3.10Windows x86-64

litequant-3.0.4-cp39-cp39-win_amd64.whl (165.8 kB view details)

Uploaded CPython 3.9Windows x86-64

litequant-3.0.4-cp38-cp38-win_amd64.whl (167.3 kB view details)

Uploaded CPython 3.8Windows x86-64

File details

Details for the file litequant-3.0.4-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: litequant-3.0.4-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 164.3 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for litequant-3.0.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 627ac8748482e219711a88e5bbd084639ee3832b15e27b58152fa57e0720080f
MD5 0cc00a5fb716bbe1bb4f8fff2027e667
BLAKE2b-256 59dc570ad68a20f73baa06687cc0703d055ac790777130b4397a1e3bdcffe891

See more details on using hashes here.

File details

Details for the file litequant-3.0.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: litequant-3.0.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 162.0 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for litequant-3.0.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9685ac0682e8e0e757b48872a85a83442f4a67722ad6ae643366e72914ddae17
MD5 6e21a136852dfbb65638eba6339df274
BLAKE2b-256 85b967008ccb2223eb7e003fe2844c4e6e7669027fb864555186c4fcf720bac0

See more details on using hashes here.

File details

Details for the file litequant-3.0.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: litequant-3.0.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 161.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for litequant-3.0.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7cb69df97d1aa989a3d609633fa45a0b091963d833e5506f26644dbe680806e6
MD5 14698ee36f94d9f3ee6c8a962cd9c7c6
BLAKE2b-256 3b728b68e245dcd3f7eae6a745fa2663d64d3eb308bcc929db3ffd242208a6d6

See more details on using hashes here.

File details

Details for the file litequant-3.0.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: litequant-3.0.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 166.7 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for litequant-3.0.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d500a34b7d3d69156ad0e100c96f35fe7fad838b00795427efb6d6cc24eb5e40
MD5 664a7f5ea46c9cdbef106d1dabd69e32
BLAKE2b-256 ab0c2a5eac237620e7c4e594f1b3e78e0040d94964f4bc30a386eda73aa774f2

See more details on using hashes here.

File details

Details for the file litequant-3.0.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: litequant-3.0.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 165.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for litequant-3.0.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 adbc96f5a5e5507b1af7c72c5378885a2c0b108d56114896ec13443a01a5d778
MD5 c3dbffb03666c3bc529a30c2794a46c9
BLAKE2b-256 744b1639b984d8e0b164246a374535ef1acb28aad6b0d70b04854cf040c0a12e

See more details on using hashes here.

File details

Details for the file litequant-3.0.4-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: litequant-3.0.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 165.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for litequant-3.0.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b632c3f512f2e33e0e2b4fd597e281a13bb43a1279629baa18781a0f18cc9f0d
MD5 249ba0daf3897c302915cc81561811a3
BLAKE2b-256 5934d7715e034a1e92862b0d06417a6fb4ed21187451e15f908ad8dab0d67c20

See more details on using hashes here.

File details

Details for the file litequant-3.0.4-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: litequant-3.0.4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 167.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for litequant-3.0.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 399c6f2cb500fc690fe853b4dfd0576da4897ec39e9975f63e584bec851ace6d
MD5 6e1223c26fa60b135f538e3a5e27abff
BLAKE2b-256 3edfef687fcc5522347ab9d0e2c3436e9e71a1a309b945dfb29320d990228b9a

See more details on using hashes here.

Release history Release notifications | RSS feed

3.0.5

7 files

This release

3.0.4 This release

7 files

3.0.3

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

0.1.1

2 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