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.
本项目仅用于研究和教育目的,不构成投资建议、交易信号或金融建议。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tj_datamodel-0.1.0.tar.gz.
File metadata
- Download URL: tj_datamodel-0.1.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33e02ae3687331b59d311a9536246c642e987480eb9a7f2309e93913f9e02cd1
|
|
| MD5 |
50ef1721dd1d2539e0775e506432d40d
|
|
| BLAKE2b-256 |
1e925f890e4ef0a3292f401cbaa8ad538529ce593ae89ff9592e1c869368565c
|
Provenance
The following attestation bundles were made for tj_datamodel-0.1.0.tar.gz:
Publisher:
release.yml on Angryshark128/tj-datamodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tj_datamodel-0.1.0.tar.gz -
Subject digest:
33e02ae3687331b59d311a9536246c642e987480eb9a7f2309e93913f9e02cd1 - Sigstore transparency entry: 2346678493
- Sigstore integration time:
-
Permalink:
Angryshark128/tj-datamodel@eb602204c49a6a72abe5dc806b4f0eb7ef563162 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Angryshark128
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@eb602204c49a6a72abe5dc806b4f0eb7ef563162 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tj_datamodel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tj_datamodel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4de30f2f47585d39679aee0afa5f976551fa27bf6270dc90a93bcab750b73052
|
|
| MD5 |
e8880162d05fc04d2e0d45510266f61f
|
|
| BLAKE2b-256 |
e42e294cbf3f0871363916c0e61208720e91e08a608644d12aa60fb287548d5a
|
Provenance
The following attestation bundles were made for tj_datamodel-0.1.0-py3-none-any.whl:
Publisher:
release.yml on Angryshark128/tj-datamodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tj_datamodel-0.1.0-py3-none-any.whl -
Subject digest:
4de30f2f47585d39679aee0afa5f976551fa27bf6270dc90a93bcab750b73052 - Sigstore transparency entry: 2346678661
- Sigstore integration time:
-
Permalink:
Angryshark128/tj-datamodel@eb602204c49a6a72abe5dc806b4f0eb7ef563162 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Angryshark128
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@eb602204c49a6a72abe5dc806b4f0eb7ef563162 -
Trigger Event:
push
-
Statement type: