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.2.tar.gz
(26.2 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.2.tar.gz.
File metadata
- Download URL: blazestore-0.1.2.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
228c8c44a9bf722aecd60790e9de410e4aa8f2da319c30fa141b600a77c0035d
|
|
| MD5 |
63be34a94d9a173d1f68263f5ea8dd19
|
|
| BLAKE2b-256 |
4930c4193923281ad42808f271e9ad9dc025ecc6b098e6e57bbe0eb8eb7c2e3e
|
File details
Details for the file blazestore-0.1.2-py3-none-any.whl.
File metadata
- Download URL: blazestore-0.1.2-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 |
6b4834ddcdb4c445b4df4575c6ea0228ef86d65b18739de661dd7746efd49eb8
|
|
| MD5 |
bf79371038716379ffe7f66a033f024a
|
|
| BLAKE2b-256 |
184bd84253f17419f920d0355c56265e7f82086d870104c42b52099ee34bd56c
|