Ashutosh0x/rust-finance
A high-performance, ultra low-latency trading terminal and AI-infused daemon built completely in Rust.
RustFinance Terminal (Rust‑Forge) – What It Is
RustFinance is an open‑source, Rust‑only trading platform that bundles together:
- Real‑time market‑data ingestion from a wide range of sources – direct exchange binary feeds (Nasdaq ITCH/OUCH, NYSE XDP/Pillar), broker APIs (Alpaca), crypto WebSockets (Binance), and data providers (Finnhub, Polymarket).
- A full‑screen terminal UI built with the Ratatui TUI library, showing live order‑book depth, price charts, risk metrics and AI‑generated commentary.
- AI analysis powered by Anthropic’s Claude model (named Dexter in the code). The model receives market snapshots and produces natural‑language insights that are displayed in the dashboard.
- Quantitative tools – a library of micro‑structure indicators (MLOFI, VPIN, Kyle’s Lambda, etc.), risk models (GARCH(1,1), VaR), and execution algorithms (TWAP, VWAP, Iceberg, Almgren‑Chriss optimal execution).
- Order‑execution engine that can talk natively to exchange gateways (Nasdaq OUCH, NYSE Pillar) or via broker APIs (Alpaca, Binance). It also includes a simulated “paper‑trading” mode.
- Infrastructure – a daemon process that runs the data‑pipeline, an event bus (Postcard‑serialised TCP) that connects the daemon to the TUI, and persistence layers using PostgreSQL and Redis.
- Research‑grade components – a 1,400‑line LaTeX research paper, 294 unit tests for the exchange adapters, and a 100 k‑agent parallel market‑microstructure simulator.
All of this is packaged as a single binary (or a set of crates) that can be built with cargo run -p tui --release for the UI or cargo run -p daemon --release for the back‑end.
Why It Might Matter
- Performance‑first – written entirely in Rust, it aims for nanosecond‑precision timestamps and sub‑millisecond end‑to‑end latency, which is essential for high‑frequency or algorithmic trading research.
- Open‑source research platform – the repo includes a detailed architecture diagram, a research paper, and many benchmark tests, making it a useful reference for anyone building low‑latency trading systems.
- AI‑augmented decision support – integrating Claude lets users experiment with large‑language‑model‑driven market commentary without leaving the terminal.
- Modular design – 38 crates separate concerns (feeds, execution, risk, AI, persistence), so developers can replace or extend individual pieces (e.g., plug in a different ML model).
Core Components (as described in the README)
| Component | Role | Notable Tech |
|---|---|---|
| Daemon | Orchestrates data ingestion, AI analysis, risk checks, and execution. | Tokio, Rayon, Postcard TCP bus |
| TUI Dashboard | Interactive terminal UI with six screens (order‑book, charts, risk, AI notes, etc.). | Ratatui |
| Exchange Core | Wire‑level parsers for ITCH, OUCH, XDP, Pillar, plus exact‑fixed‑point price handling. | Pure Rust, no vendor SDK |
| AI Engine | Calls Anthropic Claude, routes signals to the strategy dispatcher. | ai crate, Claude API wrapper |
| Quant Library | Indicators, micro‑structure metrics, pricing models (Black‑Scholes, Heston). | signals crate, 2026 Quant Alpha Library |
| Execution Engine | Implements TWAP, VWAP, Iceberg, POV, and Almgren‑Chriss optimal execution. | execution crate |
| Risk Gate | GARCH volatility, VaR, kill‑switch, regime detection, toxicity gating. | risk crate |
| Knowledge Graph | RAG‑style graph of market concepts for AI reasoning. | knowledge_graph (petgraph) |
| Persistence | Stores events and state for replay and analytics. | PostgreSQL, Redis |
| Simulator | 100 k‑agent parallel market‑microstructure simulation. | Rayon |
| Compliance | Pre‑trade checks for SEBI 2026 Algo‑ID, OPS thresholds, audit trail. | compliance crate |
Getting Started (from the README)
- Run the UI locally
cargo run -p tui --release - Start the back‑end daemon (mock data for quick start)
USE_MOCK=1 cargo run -p daemon --release - Live crypto feed (no API key needed)
This connects to Binance’s public WebSocket and streams real‑time candlesticks through the full pipeline.USE_MOCK=0 SYMBOLS_CRYPTO=BTCUSDT,ETHUSDT cargo run -p daemon --release - Explore the demo video – a short GIF is linked in the README.
- Read the docs –
docs/DIRECT_EXCHANGE_CONNECTIVITY.md,docs/latency.md, and the research paper (rustfinance.pdf).
Who Might Use It
- Quant researchers looking for a Rust‑based sandbox that includes both market‑data plumbing and a library of micro‑structure indicators.
- Developers interested in low‑latency trading infrastructure who want a reference implementation of exchange binary protocols.
- AI/ML enthusiasts who want to experiment with LLM‑driven market commentary integrated into a live trading UI.
- Educators who need a concrete, open‑source example of a full‑stack trading system for teaching systems programming or finance.
Caveats (as stated by the authors)
- The project is research software, not a broker or a guaranteed production‑ready trading system.
- Users should paper‑trade and perform independent code reviews before risking real capital.
- Some components (e.g., direct exchange connectivity) require co‑location or privileged network access to function on live venues.
Bottom line: RustFinance is a comprehensive, Rust‑centric, AI‑enhanced trading terminal that brings together market‑data ingestion, quantitative analysis, risk management, and execution in a single open‑source codebase. It is squarely within the realm of frontier finance/AI tooling, making it a valid subject for a non‑expert but curious audience.
Related
- Project
- Project
- Project
- Project
- Project