Koukyosyumei/h5i-db
About
An agent-native workspace for quantitative research: an in-terminal notebook, a high-performance time-series database, and a high-throughput backtesting engine. Written in Rust.
Data & AnalyticsMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Originalh5i-db
English · Español · Français · 简体中文 · 日本語
h5i-db is an embedded time-series database and event-driven backtester for quant research.
- Backtest from Python:
pip install h5i-db, no server. Replays 3.05M events/s, and every run is pinned to a data version. - No lookahead by construction: pin a decision time, and no row from after it can reach your frame.
- Cheap experiments: each run executes in its own fork of the database. A parameter sweep is one fork per trial, ranked out of sample, with no data copied.
- Review in the browser:
h5i-db uiputs trials, forks, versions and pending writes on one page, ordered by what needs a human next.
pip install h5i-db # Python library: database + backtester
cargo install h5i-db-cli # CLI and web UI
h5i-db ui market.db # review surface on 127.0.0.1:7351
npx skills add h5i-dev/h5i-db # agent skill (Claude Code, Codex, Cursor, …)
1. Backtest in Python
import h5i_db
from h5i_db import backtest
db = h5i_db.Database("market.db")
config = backtest.BacktestConfig(
run_id="momentum-001",
data=backtest.DataConfig(signals="signals", snapshot="2024-q1"), # the pin
portfolio=backtest.PortfolioConfig(starting_cash=100_000.0),
execution=backtest.ExecutionConfig(fee_kind="kalshi", fee_rate=0.07),
risk=backtest.RiskConfig(max_order_quantity=500.0),
)
backtest.inspect(db, config).raise_for_errors() # refuse claims the data can't support
result = backtest.execute(db, config) # replays inside fork "bt-momentum-001"
result.summary() # fills, final cash, how far it actually simulated
result.explain() # why orders were rejected or never filled
result.fills # Arrow, or just SQL it: SELECT * FROM bt_fills
result.tearsheet("run.html")
result.verify() # re-execute the stored config and compare
A parameter grid becomes one fork per trial. Give it train and holdout windows, and the leaderboard is read out of sample:
board = backtest.study(
db, study_id="fees", base=config,
parameters={"execution.fee_rate": [0.0, 0.02, 0.07]},
validation=backtest.ValidationWindows(
train=("2024-01-01", "2024-04-01"), holdout=("2024-04-01", "2024-07-01")
),
).leaderboard("holdout_final_cash")
- Venues: Kalshi, Polymarket, Hyperliquid, Binance, Limitless, Opinion, Manifold, and any OHLCV or trade dump. Loaders read files you already have; see the venue guide.
- Statistics: factor and performance metrics at
alphalensandempyricalparity, plus deflated Sharpe and probability of backtest overfitting. - Data in and out:
db.append,db.sql(...), time-series SQL (ASOF join,time_bucket,vwap, rolling windows), and any past version throughdb.read(..., version=n).
2. Research lab
apps/lab/demo.sh starts the lab on 127.0.0.1:8202 with PostgreSQL in Docker, a synthetic market and three scripted agents (apps/lab/demo.sh down stops it). To run it on your own data, see apps/lab/README.md.
- Review queue: frozen strategies with their code, parameters, equity curve, costs and holdout result, to promote, reject or comment on.
- Leaderboard: families ranked by deflated Sharpe, which drops as a family tries more variants. Raw returns stay on the trials.
- Trials: every counted run with return, max drawdown, Sharpe, fills, costs and an equity sparkline, all from the engine's fills.
- Alerts: reads past a decision time, refused backtests, a spent holdout.
3. Documentation
- Manual: Backtesting, Quant, CLI, Notebooks
- Python API · Cookbook · Agent skill
- Benchmarks: against DuckDB, Polars, ArcticDB, NautilusTrader and LEAN
- Why h5i-db: what it gives agents, and when not to use it
- Development · Design · Operations · Roadmap
4. License
Apache-2.0. See LICENSE.
Explore related projects
Loading…