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.1.tar.gz
(24.5 kB
view details)
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 blazestore-0.1.1.tar.gz.
File metadata
- Download URL: blazestore-0.1.1.tar.gz
- Upload date:
- Size: 24.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
524609f1251190f6b6cabe18794866865caa80e21d260b0a5730eb572d2f6399
|
|
| MD5 |
b3f9c7b4e9766d329cdedbf43ef544a8
|
|
| BLAKE2b-256 |
cc84f6768e27dc2cdeb2ba2822389f2c5de26434771f1a82fdb524e2e77f3f5a
|
File details
Details for the file blazestore-0.1.1-py3-none-any.whl.
File metadata
- Download URL: blazestore-0.1.1-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9895fc459254e2f99ee8f865fa5c969b091d28b8634ea07cf4151fd1e5eea0d
|
|
| MD5 |
95750241ef47a0fadf6c95f0bab68c4e
|
|
| BLAKE2b-256 |
1ebe78af7e0551d9f88c8242b34e3dbf33f359e608fdd1c0467e91ef0a0e17a1
|