Skip to main content

The blazing-fast data toolkit for quantitative workflows

Project description

BlazeStore

🚀 blazestore —— The blazing-fast data toolkit for quantitative workflows 专注于本地量化数据的高效管理与读写,具备以下特点:

  • High Performance:借助 polars(Rust 实现),大幅优于 pandas,单机内存/多核利用率高,I/O 高效,支持宽表大数据量(TB 级别)分析。
  • 分区与列式存储:自动按日期等分区,底层 Parquet 格式,适合全频段(tick/分钟/日线)数据。
  • 支持本地高效的数据读写、SQL 查询、分区管理,并方便与主流数据库(MySQL、ClickHouse)集成。
  • 内置任务调度与批量更新(DataUpdater),适合日常行情和因子数据自动维护。
  • 支持因子工程,便于复用、管理、批量计算和依赖关系控制,适合复杂因子体系的量化研究。

Installation

pip install -U blazestore

QuickStart

import blazestore as bs

# 获取配置
bs.get_settings()

# 假设有一个polars.DataFrame df, 内容为分钟频数据
kline_df = ... # date | time | asset | open | high | low | close | volume

# 持久化, 存放在表格 market_data/kline_minute, 按照日期分区
tb_name = "market_data/kline_minute"
bs.put(kline_df, tb_name=tb_name, partitions=["date", ],)
print((bs.DB_PATH/tb_name).exists()) # True

# read local data
query = f"select * from {tb_name} where date = '2025-05-06';"

read_df = bs.sql(query)

Examples

1.update data

import blazestore as bs
from blazestore import DataUpdater

# implement update function
def update_kline_daily():
    # 读取 clickhouse中的 行情数据落到本地
    query = ...
    kline_minute = bs.read_ck(query, db_conf="databases.ck")
    bs.put(kline_minute, tb_name="market_data/kline_minute", partitions=["date", ])

# create data updater
updater = DataUpdater(name="行情数据更新器")
updater.add_task(task_name="分钟行情", update_fn=update_kline_daily)
updater.do()

2.customize data

from blazestore import Factor

# 日频因子
def my_day_factor(date):
    """实现当天的因子计算逻辑"""
    ...
fac_myday = Factor(fn=my_day_factor)

# 分钟频因子, 增加形参 `end_time`
def my_minute_factor(date, end_time):
    """实现在end_time时的因子计算逻辑"""
    ...

fac_myminute = Factor(fn=my_minute_factor)

3.expression database

import blazestore as bs

# create expression database from polars dataframe
df_pl = bs.sql(query="select * from maket_data/kline_minute where date='2025-05-06';")
db = bs.from_polars(df_pl)

exprs = [
    "ind_pct(close, 1) as roc_intraday", 
    "ind_mean(roc_intraday, 20) as roc_ma20", 
]

result = db.sql(*exprs)

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

blazestore-0.1.4.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

blazestore-0.1.4-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file blazestore-0.1.4.tar.gz.

File metadata

  • Download URL: blazestore-0.1.4.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for blazestore-0.1.4.tar.gz
Algorithm Hash digest
SHA256 be45e1a3e891c00ed99c49f32856736fada67e32254ed12f3a9dd81a8ced8ad5
MD5 468eb2bc18b72ae352d56f7eac2dd202
BLAKE2b-256 f8a1eef2e91b9b09c381f0f6f7839912cd4f081d37751178e1bfeec5deeb2ad8

See more details on using hashes here.

File details

Details for the file blazestore-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: blazestore-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for blazestore-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7d2dece9f20ce5a4662f921d24f06e81870cb8db0da51e0c270e744cf417253a
MD5 68ef2ba309e176c310ad522aaf43491f
BLAKE2b-256 4078045330b4bd2632928fe5dd9c32782b05d8cbf9e3d2e84e2bddd3d94b1b21

See more details on using hashes here.

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