Skip to main content

The blazing-fast data toolkit for quantitative workflows

Project description

BlazeStore

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

  • 持久化: 基于polars的高性能读写
  • 便捷性: 内存数据库-根据polars读取parquet分区文件,支持sql查询以及构造表达式数据库
  • 时效性: 提供数据更新器,用于每日更新
  • 扩展性: 对于自建数据源,通过构造Factor来计算、读写

安装

pip install -U blazestore

快速开始

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

# 读取
query = f"select * from {tb_name} where date = '2025-05-06';"

read_df = bs.sql(query)

示例

1.数据更新

import blazestore as bs
from blazestore import DataUpdater

# 数据更新的具体实现
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", ])

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

2.自定义因子

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)

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.0.tar.gz (24.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.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for blazestore-0.1.0.tar.gz
Algorithm Hash digest
SHA256 71b0a990de30a2fe6aa5fac959f39c28785e34e8156532f6faeeeb634a7fe72a
MD5 92518e5e914ad43ae5a743f07160e9cc
BLAKE2b-256 23e2d996ca5c9bed286ec3e457ba67fb748a6d581d947f111f90621360013baa

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for blazestore-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccee93ca690e4b15002f5134db3ec612c956f6ea034690732060ffebde25c4b6
MD5 e1270c90d3c1720a3242ff583a304d23
BLAKE2b-256 8f1fa5a5241d829f2e4ebfef6fc1355ab10700139114cd48c83d77f6100769b2

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