Skip to content
المشاريع

حول

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.

البيانات والتحليلات

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
+١
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

h5i-db

tests downloads Apache-2.0

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 ui puts 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 alphalens and empyrical parity, 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 through db.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.

h5i-db research lab: review queue, leaderboard and trials


3. Documentation


4. License

Apache-2.0. See LICENSE.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…