h5i-db is a high-performance analytical database for quantitative finance and time-series workloads, designed for AI agents and written in Rust. Full SQL with native ASOF joins, OHLCV rollups, and VWAP, running directly on immutable Parquet segments.
Polars-class analytics, with a real database underneath.
cargo install h5i-db-cli
pip install h5i-db
A storage kernel and query engine tuned for the time axis: data is time-sorted on disk, pruned by manifest statistics before I/O, and queried through DataFusion SQL with native time-series operators. Version control, time travel, and previewable mutations come built in, so the speed never costs you safety.
ASOF JOIN, time_bucket, vwap, wavg, and
ewma. Storage is time-sorted, so bucketed aggregations stream instead of sorting.--stats.version_conflict, never last-writer-wins.as_of lookups are O(log V), and any past state
is one manifest read away.h5i('trades', 42) reads version 42; an RFC3339 timestamp reads
as of a commit time; named snapshots pin exact versions across tables, keeping backtests
reproducible forever.--plan runs the full write path but stops before publish:
exact affected rows, segments rewritten vs reused, before/after samples. plan apply
is a metadata-only swap, and a mutation policy can force agents through review.verify --deep re-checks the whole store.to_pandas() and Arrow interchange keep it inside your
existing research stack.20M trades and 5M quotes, disk-backed on all sides: h5i-db segments vs
Polars, DuckDB, pandas, and PyArrow over the identical Parquet files, measured back-to-back
in one session. Reproduce with cargo run -p h5i-db-bench.
| workload | h5i-db | polars 1.43 | duckdb 1.5 | pandas 3.0 | pyarrow 25 |
|---|---|---|---|---|---|
| time-range scan 0.01% (48/50 segments pruned) | 7.3 ms | 15.0 ms | 17.0 ms | 13.5 ms | 10.1 ms |
| time-range scan 1% | 6.3 ms | 14.1 ms | 15.0 ms | 13.3 ms | 10.3 ms |
| 1-minute OHLCV + VWAP rollup | 164 ms | 2 392 ms | 774 ms | 4 242 ms | 2 369 ms |
| ASOF join trades × quotes (by symbol) | 439 ms | 408 ms | 952 ms | 4 535 ms | n/a¹ |
| full aggregation (group by symbol) | 47 ms | 90 ms | 47 ms | 653 ms | 113 ms |
| ingest (50 durable commits) | 3.7 M rows/s | n/a | n/a | n/a | n/a |
| cold read of an old version | 1.4 ms | n/a | n/a | n/a | n/a |
Narrow scans win on manifest pruning. The OHLCV rollup wins 4.7–26×
because storage is already time-sorted and declared so — every baseline pays for a 20M-row sort.
ASOF is a tie with Polars, full-scan decode a tie with DuckDB, both by design — and only one side
has time travel, snapshots, previewable mutations, and crash-safe commits.
¹ PyArrow's experimental join_asof: 44.5 s at 2M rows, excluded. Full methodology in
benchmarks/RESULTS.md.
No MCP server, no custom protocol: agents drive the same CLI and Python API as everyone else. The contract is what makes it agent-ready: machine-readable output, structured errors, hard resource limits, and a write path that policy can gate behind review.
$ h5i-db query market.db "SELECT symbol, vwap(price,size) FROM trades GROUP BY symbol" \ --format json --max-rows 1000 --timeout 30s # machine formats + hard limits $ h5i-db delete-range market.db trades --start 09:30 --end 09:31 --plan {"plan_id": "5c41…", "summary": {"rows_affected": 12481, "segments_reused": 127}} # errors are {code, message, retryable, hint} on stderr; exit codes are stable $ h5i-db policy set market.db direct_delete=false # agents must preview; humans can too ✔ deletes now require a reviewed plan
retryable flag and an actionable hint, and stable exit codes (0/2/3/4/5) an
agent can branch on.--read-only. A supervisor can hard-cap any call without touching the database.execution_mode and the
plan hash.h5i-db ui market.db serves a loopback-only review surface:
pending plans with exact previews, apply and reject, a version timeline with audit badges,
version diffs, and an SQL scratchpad that shows pruning on every query. Read-only unless started
with --allow-mutations.
One embedded database for backtests, live research, and the agents that run them. Rust core, DataFusion SQL, versioned Parquet storage. Apache 2.0, no server, no lock-in.