Skip to main content

AxData

AxData 是一个开源量化数据库框架,面向个人量化研究、本地数据管理和数据源插件开发。

这个 PyPI 包提供统一的 Python 安装入口,包含:

  • Python SDK
  • AxData CLI
  • 核心框架
  • 默认随包的数据源 Provider 模块

安装后可以在本地直接使用 SDK 和 CLI;不需要先启动 HTTP 服务。需要 Web 控制台、源码开发或二次扩展时,建议按项目文档使用完整项目安装方式。

项目文档:https://electkismet.github.io/AxData/

安装

pip install axdata

升级

升级已有的 PyPI 安装:

python -m pip install --upgrade axdata

基础用法

import axdata as ax

client = ax.AxDataClient()

stocks = client.stock_basic_exchange(
    exchange="SSE",
    fields=["instrument_id", "name", "region", "list_date"],
)

bars = client.daily(
    ts_code="000001.SZ",
    start_date="20250101",
    end_date="20250131",
    fields=["ts_code", "trade_date", "open", "close"],
)

print(stocks.head())
print(bars.head())

默认情况下,AxDataClient() 使用本地模式,直接读取当前机器上的 AxData 数据目录。Notebook、脚本、回测或因子研究不需要先启动本地 HTTP 服务。

local = ax.AxDataClient()
snapshot = ax.AxDataClient(data_root="/data/axdata-snapshot")

只有当 SDK 需要访问另一台机器、另一个进程或服务器上的 AxData HTTP API 时,才需要传入 api_base:

remote = ax.AxDataClient(api_base="http://192.168.1.20:8666", token="your-token")
stocks = remote.stock_basic_exchange(exchange="SZSE", fields=["instrument_id", "name", "list_date"])

也可以通过环境变量指定数据目录或 API 地址:

export AXDATA_DATA_DIR="/data/axdata/current"
export AXDATA_API_BASE="http://192.168.1.20:8666"
export AXDATA_TOKEN="your-token"

如果设置了 AXDATA_API_BASE,AxDataClient() 会默认使用 API 模式。需要在这种环境里强制使用本地模式时,可以使用 AxDataClient.local(...) 或 mode="local"。

数据源请求

client.call(...) 用于临时请求数据源接口,默认不写入本地数据目录:

quote = client.call(
    "stock_realtime_snapshot_tdx",
    code="000001.SZ",
    fields=["instrument_id", "last_price", "change_pct"],
)

finance = client.call("stock_finance_summary_tdx", code="000001.SZ")

数据源请求和采集入库是两层能力:

  • Source Provider 负责临时请求源端接口。
  • Collector 负责把数据写成本地 Parquet/DuckDB 可查询资产。

因此,能通过 client.call(...) 请求的接口,不等于已经有对应的长期入库采集任务。

常用入口

client = ax.AxDataClient()
local = ax.AxDataClient.local(data_root="/data/axdata/current")
remote = ax.AxDataClient.api(api_base="http://192.168.1.20:8666", token=None)

常用方法:

  • client.query(api_name, fields=None, **params)
  • client.daily(fields=None, **params)
  • client.adj_factor(fields=None, **params)
  • client.trade_cal(fields=None, **params)
  • client.stock_basic_exchange(fields=None, **params)
  • client.call(interface, fields=None, options=None, **params)
  • client.stream(stream, fields=None, **params)
  • client.session(source="tdx" | "tdx_ext", **options)
  • ax.pro_api(...)
  • ax.download(...)
  • ax.get(...)

所有查询和数据源请求默认返回 pandas.DataFrame。

完整项目

如果需要 Web 控制台、接口文档、插件管理页面、API 服务和源码开发环境,请使用完整项目安装方式:

git clone https://github.com/electkismet/AxData.git AxData

完整安装说明见项目文档:

https://electkismet.github.io/AxData/

使用声明

本项目仅是一个开源量化数据库框架,数据接口部分基于互联网公开信息搜集整理。项目不提供商业数据服务,也不代表任何第三方数据源、网站或开源项目的授权。

通过本项目访问或获取第三方数据时,用户需自行遵守相关法律法规、数据源条款、网站规则和服务协议。

Metadata

Release files for axdata 0.1.4

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

Source distribution (sdist)

Source distribution for axdata 0.1.4
File Size Uploaded
axdata-0.1.4.tar.gz 800.0 kB Details

Built distribution (wheel)

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

Total release size: 1.8 MB

Release files / axdata-0.1.4.tar.gz

Download URL axdata-0.1.4.tar.gz
Size 800.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2cc06bf44c08aa983634b91b3266a5b97b8cbbc02670d9554bb2387a5d76b3a5
BLAKE2b-256 checksum
How to use checksums
40b1778208472b86fb5a09e9a50b0825d7c6ac2e9a8e820e40e4ae8a8feb66c7
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 13, 2026.

Transparency log

Release files / axdata-0.1.4-py3-none-any.whl

Download URL axdata-0.1.4-py3-none-any.whl
Size 996.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb4fba2ec53f8496d44d0b80e366c215816d290086bff9aad879924ecedd181c
BLAKE2b-256 checksum
How to use checksums
c60d921da9ff5eec33fd527777007e44d3a5f8a82bc81ed24910f9210a04676c
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 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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