QuantForge is a CLI-first, deterministic trading research toolkit written in Rust. It focuses on market data ingestion, strict normalization, reproducible backtesting, and a strategy SDK for building TradingView/PineScript-like workflows in pure Rust.
This initial release is intentionally small and opinionated:
- Binance Spot OHLCV download over public REST endpoints
- SQLite candle storage with idempotent upserts
- validation for gaps, duplicates, ordering, and OHLC sanity
- deterministic event-driven backtesting
- built-in SMA crossover example strategy
There is no UI. The CLI is the product.
This repository is intentionally structured as a single Cargo package for the first public release so versioning, publishing, installation, and contributor onboarding stay simple.
Internal boundaries still exist as Rust modules:
model- normalized market types and validationexchange- exchange client trait and Binance implementationstorage- candle store trait and SQLite implementationsdk- strategy trait, context, indicators, example strategiesbacktest- deterministic bar-by-bar engine
Backtests in QuantForge follow these rules:
- timestamps are stored as UTC epoch milliseconds
- prices and volumes use decimal arithmetic, not floating-point math
- strategies observe a bar at close and submit intent
- the engine executes that intent at the next bar open
- data validation is explicit, not best-effort
If the quantforge package name is available on crates.io:
cargo install quantforge --lockedIf you are working from source:
cargo install --path . --lockedDownload candles into SQLite:
quantforge --db data/market.sqlite download \
--symbol BTCUSDT \
--interval 1m \
--start 2024-01-01T00:00:00Z \
--end 2024-01-02T00:00:00ZValidate the stored series:
quantforge --db data/market.sqlite validate \
--symbol BTCUSDT \
--interval 1mRun the built-in SMA crossover backtest:
quantforge --db data/market.sqlite backtest \
--symbol BTCUSDT \
--interval 1m \
--fast 20 \
--slow 50 \
--cash 10000 \
--fee-bps 10Run the full quality gate before opening a PR:
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features --locked
./scripts/release-check.shBuild the CLI image:
docker build -t quantforge:0.1.0 .Run the CLI inside Docker:
docker run --rm -v "$PWD/data:/data" quantforge:0.1.0 \
--db /data/market.sqlite \
validate --symbol BTCUSDT --interval 1m- incremental download and resume support
- additional exchanges such as Bybit
- more indicators and a richer strategy SDK
- alternative storage backends such as Parquet or Postgres
- research-oriented parameter sweeps and snapshot reports
Licensed under MIT license.