Skip to main content

PyPI version PyPI - Python CI License

Tianji DataModel

Tianji 生态的共享数据模型,零外部运行时依赖。

Tianji DataModel 是 Tianji 开源市场研究工具生态的基础约定层,被 tj-symbols / tj-data 等模块复用,保证各包之间的数据格式一致。

特性

  • 不可变数据模型:Symbol / Bar / ReturnPoint / EquityPoint
  • 6 个共享枚举:Market / Exchange / AssetType / Currency / Frequency / AdjustType
  • 统一异常体系:TianjiDataModelError / ValidationError
  • 校验函数:validate_symbol / validate_bar / validate_point_date
  • 离线优先,零外部数据依赖

安装

pip install tj-datamodel

快速开始

from datetime import date
from tj_datamodel import Exchange, AssetType, Symbol, Bar

s = Symbol(
    code="600519",
    exchange=Exchange.SSE,
    suffix="SH",
    market=Market.CN_A_SHARE,
    asset_type=AssetType.STOCK,
    normalized="600519.SH",
)
s.normalized  # "600519.SH"

bar = Bar(
    symbol="600519.SH",
    trade_date=date(2026, 8, 6),
    open=1450.0, high=1488.0, low=1440.0, close=1472.0,
    volume=3_200_000, amount=4_700_000_000,
)

开发

uv sync --group dev
uv run ruff check .
uv run ruff format --check .
uv run pyright
uv run pytest -q

Tianji 生态

Tianji 是一套面向市场研究的可组合开源工具生态。每个子项目都可以独立使用,也可以组合成完整的市场研究工作流。

  • tj-calendar: 离线优先的交易日历
  • tj-symbols: 证券代码标准化与格式转换
  • tj-data: 市场数据适配与本地缓存
  • tj-factors: 技术指标与因子
  • tj-metrics: 绩效指标
  • tj-backtest: 轻量回测
  • tj-research: AI 辅助研究
  • tj-terminal: 综合研究工作台

Disclaimer / 免责声明

This project is for research and educational purposes only. It does not provide investment advice, trading signals, or financial recommendations.

本项目仅用于研究和教育目的,不构成投资建议、交易信号或金融建议。

Metadata

Release files for tj-datamodel 0.1.0

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

Source distribution (sdist)

Source distribution for tj-datamodel 0.1.0
File Size Uploaded
tj_datamodel-0.1.0.tar.gz 16.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tj-datamodel 0.1.0
File Interpreter ABI Platform
tj_datamodel-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / tj_datamodel-0.1.0.tar.gz

Download URL tj_datamodel-0.1.0.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
33e02ae3687331b59d311a9536246c642e987480eb9a7f2309e93913f9e02cd1
BLAKE2b-256 checksum
How to use checksums
1e925f890e4ef0a3292f401cbaa8ad538529ce593ae89ff9592e1c869368565c
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 5, 2026.

Transparency log

Release files / tj_datamodel-0.1.0-py3-none-any.whl

Download URL tj_datamodel-0.1.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4de30f2f47585d39679aee0afa5f976551fa27bf6270dc90a93bcab750b73052
BLAKE2b-256 checksum
How to use checksums
e42e294cbf3f0871363916c0e61208720e91e08a608644d12aa60fb287548d5a
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 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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