Local-first systematic trading research and paper-trading platform for US equities and crypto. Built to mirror how modern quant firms structure their research stack, scaled down for one engineer.
**Phase 1, Milestone 1: Data layer — DONE **
- Repo skeleton, dependencies, Docker setup
- Canonical bar schema + asset types
- Pluggable
BarSourceprotocol - Alpaca source (US equities, free tier)
- Binance source (crypto, public API)
- Parquet bar store with year-partitioning + dedup
- Incremental ingestion service
- CLI (
scripts/ingest.py) - Tests (6/6 passing)
Next up — Phase 1 remaining milestones:
- Feature library (Polars-expression-based, ~30 features)
- First strategy (cross-sectional momentum + low-vol filter)
- Backtest harness (Nautilus Trader integration)
- Walk-forward purged CV (López de Prado)
- Reporting (Sharpe, Sortino, max DD, turnover, attribution)
- Paper trading wiring (Alpaca paper account)
Phase 2 — Modern ML: LightGBM with purged CV, sequence models (TCN/transformer) on intraday features, meta-labeling, HRP for portfolio construction.
Phase 3 — Execution & microstructure: order book features, optimal execution algos, transaction cost analysis.
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"Or with plain pip:
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"Copy .env.example to .env and fill in:
- Alpaca — sign up at https://alpaca.markets, generate paper trading keys (free, no credit card)
- Binance Testnet — https://testnet.binance.vision (only needed when we get to crypto paper trading)
cd docker
docker compose up -d postgres mlflowYou can skip this for now — Phase 1 milestone 1 only needs the file system.
# Daily bars for the whole universe, last 5 years
python scripts/ingest.py --interval 1d --start 2020-01-01
# 1-min bars for crypto, last year
python scripts/ingest.py --interval 1m --start 2025-01-01 --asset-class crypto
# Run again — incremental: only fetches what's missing
python scripts/ingest.py --interval 1d --start 2020-01-01Data lands in data/processed/bars/{asset_class}/{symbol}/interval={interval}/year={year}/data.parquet.
pytest -vsrc/quant/
├── data/ Ingestion, storage, point-in-time access
├── features/ Feature engineering (Polars expressions)
├── models/ ML training pipelines
├── strategies/ Signal → target positions
├── backtest/ Event-driven backtester + cost models
├── portfolio/ Position sizing, optimization
├── execution/ Broker adapters (Alpaca, Binance), OMS
├── monitoring/ Live P&L, drift, alerts
└── utils/ Logging, config, time
The repo is local-first: everything runs on your laptop. Once strategies are stable, the same code deploys to a VM or container with no changes — config is env-driven.
- Local-first, cloud-ready. Develop offline; deploy when ready.
- Source/store separation. Swapping data providers is a one-file change.
- One bar schema everywhere. Equity, crypto, future asset classes all use the same canonical schema.
- Polars over pandas. Faster, lazier, less footgunny. Pandas only at library boundaries.
- Same code for backtest and live. Nautilus Trader gives us this; strategies are written once.
- Tests for the pipeline, not the alpha. We test correctness; the market judges the alpha.
- Realistic costs from day one. Half-spread, commission, slippage, market impact — all modeled.
- Not a high-frequency platform. Retail broker latency is ~50-500ms; we operate at second-and-up timescales.
- Not financial advice. This is research code; live trading with real money is your decision and your risk.
- Not a black box. Every component is meant to be understood, modified, and improved by you.