Engineering / Notes
Architecture
1) Frontend
- Next.js (TypeScript) + Tailwind + minimal shadcn-style UI.
- TradingView Lightweight Charts for candles, overlays, and markers.
- Recharts for equity, drawdown, Sharpe, histogram, and exposure views.
2) Rust API (axum)
/api/universe/api/backtests (job runner)/api/backtests/{id}/results (stored JSON)- Rate limiting and tracing logs.
- Polygon/Massive data fetch with retries and disk cache.
3) Rust engine crate
- Indicators.
- Strategy signals (no lookahead).
- Next-bar execution.
- Costs plus borrow/funding carry.
- Metrics, trades, and series output.
4) Disk volume
cache/ for market data.runs/ for configs, results, and status.
Backtesting pitfalls handled
- No lookahead: signals are based on bar-close data only.
- Next-bar execution: orders fill at next bar open (with slippage).
- Adjusted prices toggle for equities.
- Transaction costs + slippage (bps per side) always applied.
- Short borrow and funding carry modeled (annualized, dt-aware).
- Time alignment: UTC timestamps; pairs use strict timestamp intersection.
- Missing bars/gaps: never forward-filled; gaps accrue carry over dt.
- Parameter sanity guards + bounded date ranges.
- Reproducible configs: stored with run results, copyable JSON.