RustFinance Terminal, also called RustForge, is an open-source Rust trading terminal for market-data ingestion, execution research, quantitative risk controls, compliance checks, and terminal dashboards.
cargo run -p tui --releaseUSE_MOCK=1 cargo run -p daemon --releaseSafety: this project is research and open-source infrastructure. It is not financial advice, not a broker, and not a guarantee of live-trading readiness. Use paper trading and independent review before connecting real capital.
https://github.com/user-attachments/assets/c769b2c2-cfa0-44bd-a261-99786ea653e1
RustForge is an institutional-grade AI trading terminal built in pure Rust. It combines real-time multi-exchange market data, Claude-powered AI analysis, quantitative risk management, prediction market trading, and a full TUI dashboard — all in a single binary with nanosecond-precision timestamps and sub-millisecond latency.
v0.4 — 2026 Quant Alpha Library: Multi-level Microprice (MLOFI), Adverse Selection Detection, Regime-Conditioned Quoting, Kelly+Bayesian Sizing, Alpha Health Monitor, IC-Weighted Composite Signals, Enhanced Avellaneda-Stoikov Quoting Engine, Almgren-Chriss Optimal Execution, Live Binance WebSocket Candlestick Feed, and WebSocket Gap Detection Engine. 82+ unit tests passing on Rust 1.95.0.
| Feature | Detail |
|---|---|
| Language | Pure Rust |
| Interface | Full TUI Dashboard (Ratatui, 6 screens) |
| AI Integration | Claude-powered Dexter Analyst |
| Execution Algorithms | TWAP, VWAP, Iceberg, POV, Almgren-Chriss Optimal Execution |
| Market Making | Enhanced Avellaneda-Stoikov with regime gating, VPIN toxicity, OFI skew |
| Microstructure | Multi-level MLOFI, OFI, Microprice, Kyle's Lambda, VPIN, Amihud, Lee-Ready |
| Smart Order Router | Multi-venue scoring (fill rate, latency, fees, impact) |
| Alpha Signals | Toxicity detection, regime classifier, IC-weighted composite, alpha health |
| Position Sizing | Quarter-Kelly with Bayesian shrinkage, conviction scaling |
| Live Data | Binance WebSocket candlestick feed with gap detection engine |
| Prediction Markets | Polymarket CLOB + cross-platform arbitrage engine |
| Agent Simulation | 100K-agent Rayon-parallel swarm |
| Knowledge Graph | petgraph-backed RAG engine |
| Risk Models | GARCH(1,1) + VaR + Kill Switch + SMP + Regime Detection + Toxicity Gating |
| Timestamp Precision | Nanosecond (UnixNanos) |
| Deterministic Replay | DeterministicClock + SequenceId ordering |
| Regulatory Compliance | SEBI 2026 Algo-ID + OPS threshold + pre-trade checks |
| Fill Simulation | Almgren-Chriss √-impact model + fixed slippage |
| Alpha Monitoring | Rolling IC, Sharpe, hit rate with auto-decay detection |
| FIX Protocol | Production FIX 4.4 parser with checksum validation |
| Market Sources | Alpaca, Binance, Finnhub, Polymarket, Mock |
| Execution | Alpaca REST, Polymarket CLOB, Paper Trading |
| License | MIT |

34 modular crates, 250+ source files, strict dependency boundaries.
graph TD;
subgraph "External Feeds"
ALP(Alpaca WS) --> Ingest
BIN(Binance WS) --> Ingest
FH(Finnhub WS) --> Ingest
PM(Polymarket WS) --> Ingest
LLM(Anthropic Claude) <--> AI
end
subgraph "RustForge Engine"
Ingest(Ingestion / Source Multiplexer) --> Bus(TCP Event Bus)
Bus --> AI(AI Engine — Dexter / Mirofish)
Bus --> Quant(Quant Features)
Quant --> Swarm(Swarm Simulator — 100K Agents)
Swarm --> KG(Knowledge Graph — petgraph RAG)
KG --> AI
AI --> Strategy(Strategy Dispatcher)
Strategy --> Risk(Risk Gate — GARCH / VaR / Kill Switch)
Risk --> Exec(Execution Gateway)
Exec -.-> |Paper Mode| Mock(MockExecutor)
Exec --> |Live Mode| AlpacaAPI(Alpaca REST)
Exec --> |Prediction| PolyCLOB(Polymarket CLOB)
end
subgraph "Quantitative Models"
Pricing(Pricing Engine) --> BSM(Black-Scholes-Merton)
Pricing --> HESTON(Heston Stochastic Vol)
Risk --> GARCH(GARCH 1,1 Volatility)
Backtest(Backtest Engine) --> WF(Walk-Forward)
Backtest --> MC(Monte Carlo)
end
subgraph "Persistence"
Bus --> PG[(PostgreSQL)]
Bus --> Redis[(Redis Hot-State)]
end
subgraph "Frontends"
Bus --> TUI(Ratatui TUI Dashboard)
Bus --> Web(REST API / Web Dashboard)
end
common Nanosecond timestamps, events, config, models
ingestion Multi-source market data (Alpaca, Binance, Finnhub, Polymarket) + gap detector
execution ExecutionGateway + TWAP/VWAP/Iceberg/POV + Almgren-Chriss optimal execution
strategy Momentum, MeanReversion, Avellaneda-Stoikov (Welford O(1) variance)
risk Kill switch, GARCH vol, VaR, risk interceptor chain, self-match prevention
pricing Black-Scholes-Merton, Heston, GARCH(1,1) models
backtest Walk-forward, Monte Carlo, backtesting engine, √-impact fill model
ai Dexter AI analyst, Claude integration, signal routing
swarm_sim 100,000-agent market microstructure simulator
knowledge_graph petgraph-backed RAG knowledge engine
polymarket CLOB + EIP-712 signing + sum-to-one/cross-platform arb engine
daemon Hybrid intelligence pipeline, engine orchestration
event_bus Postcard-serialized TCP event bus (daemon <-> TUI)
tui Ratatui TUI + live Binance candlestick feed + 500 msg/frame cap
oms Order Management System (netting + hedging + SEBI 2026 Algo-ID)
alerts Rule-based alert engine
signals 2026 Quant Alpha Library (see below) + indicators + microstructure
compliance Pre-trade compliance, audit trail
persistence PostgreSQL + SQLite persistence layer
metrics Prometheus-compatible telemetry
ml Machine learning model inference, alpha decay monitoring
model Model registry and versioning
feature Feature engineering pipeline
fix FIX 4.4 protocol engine — production parser + session layer
cli Command-line interface
web REST API server
web-dashboard Web-based dashboard
dashboard Dashboard data models
tests Integration test suite
benchmarks Criterion performance benchmarks
Based on 18 research papers (2025–2026). 55 unit tests.
Indicators SMA, EMA, RSI, MACD, Bollinger Bands, VWAP
Microstructure OFI (Cont 2014), Microprice, Kyle's Lambda, VPIN (Easley 2012),
Amihud Illiquidity, Lee-Ready Trade Classifier
Microprice ML Multi-level microprice MLOFI (Oxford 2019, arXiv 2602.00776)
Adverse Select. Toxicity detection + halt/widen (Barzykin 2025, Crypto 2026)
Regime Fast/slow EMA vol ratio → LowVol/Normal/HighVol/Crisis (RegimeFolio 2025)
Kelly Quarter-Kelly + Bayesian shrinkage sizing (PolySwarm Apr 2026)
Alpha Health IC decay + hit rate monitor → Healthy/Degraded/Decayed (AlphaForgeBench 2026)
Composite IC-weighted signal combiner with regime + toxicity gating (Chain-of-Alpha 2025)
Quoting Engine Enhanced Avellaneda-Stoikov: regime γ, VPIN widening, OFI skew, Kelly sizing
Almgren-Chriss Optimal trajectory: xⱼ = X × sinh(κ(N-j)) / sinh(κN)
Urgency parameter κ = √(λσ²/η), square-root impact model
Presets: liquid_default, aggressive, passive
7 unit tests (TWAP convergence, front-loading, quantity conservation)
# 1. Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# 2. Clone
git clone https://github.com/Ashutosh0x/rust-finance.git
cd rust-finance
# 3. Configure
cp .env.example .env
# Edit .env — add your API keys (see Configuration below)
# 4. Build
cargo build --release
# 5. Run (mock mode — no API keys required)
USE_MOCK=1 cargo run -p daemon --release
# 6. Run TUI (separate terminal)
cargo run -p tui --release
UnixNanos) with monotonic SequenceId orderingRealtimeClock for live trading, DeterministicClock for backtestingEnvelope<T> wrapping every system event$ claude mcp add rust-finance \
-- python -m otcore.mcp_server <graph>