New
Apps 6,419Makers 6,403This week 7
Promote your app−30%
RustFinance Terminal screenshot 1
4views in
the last 30 days

RustFinance Terminal

A high-performance, ultra low-latency trading terminal and AI-infused daemon built completely in...

Built with Claude Code

by ashutosh0x · Unclaimed · from USUnited States · added Nov 3, 2026
no ratings0 comments

RustFinance Terminal (rust-finance)



PostgreSQL Redis Docker GitHub Actions LaTeX
GitHub stars GitHub forks Buy Me a Coffee
Alpaca Binance Finnhub Polymarket
NASDAQ NYSE CME LSE NSE BSE CRYPTO
Nasdaq TotalView-ITCH 5.0 Nasdaq OUCH 4.2 SoupBinTCP 3.00 MoldUDP64
NYSE XDP Integrated Feed NYSE Pillar Binary Gateway FIX 4.2 / 4.4 UDP Multicast Co-location
Windows macOS Linux
OpenSSF Scorecard Security & Supply Chain CI Tests dependency status License: MIT

At a Glance

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.

Safety: 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.


Overview

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 + NYSE Pillar FIX 4.2 profile
Direct Feeds Nasdaq TotalView-ITCH 5.0 (MoldUDP64/SoupBinTCP), NYSE XDP Integrated (A/B multicast)
Native Order Entry Nasdaq OUCH 4.2, NYSE Pillar Binary Gateway, NYSE Pillar FIX 4.2
Order Book Level 3 order-by-order, exact integer prices (1e-9 USD), venue-neutral
Feed Recovery MoldUDP64 re-request, Pillar retransmit + refresh, A/B line arbitration, GLIMPSE
Market Sources Nasdaq ITCH, NYSE XDP, Alpaca, Binance, Finnhub, Polymarket, Mock
Execution Nasdaq OUCH, NYSE Pillar (binary + FIX), Alpaca REST, Polymarket CLOB, Paper Trading
License MIT

Rust Trading Terminal


Table of Contents


Architecture

38 modular crates, 260+ source files, strict dependency boundaries.

graph TD;
    subgraph "Direct Exchange Feeds"
        ITCH(Nasdaq ITCH 5.0<br/>MoldUDP64 / SoupBinTCP) --> XCore(exchange-core<br/>L3 Book · Gap Tracker · Price)
        XDP(NYSE XDP Integrated<br/>A/B multicast lines) --> XCore
        XCore --> Ingest
    end

    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)
        Exec --> |Nasdaq Native| OUCH(OUCH 4.2 / SoupBinTCP)
        Exec --> |NYSE Native| PILLAR(Pillar Binary / Pillar FIX 4.2)
    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

Crate Map

common           Nanosecond timestamps, events, config, models
exchange-core    Wire primitives, exact fixed-point Price, L3 order book, gap tracker, tick-to-trade latency
nasdaq           TotalView-ITCH 5.0 + OUCH 4.2 + SoupBinTCP 3.00 + MoldUDP64
nyse             XDP Integrated Feed + Pillar Request Server + Pillar Binary Gateway + Pillar FIX 4.2
exchange         Direct-feed MarketDataSource/ExecutionGateway adapters, preflight, capture replay
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

Signals Crate — 2026 Quant Alpha Library

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

Execution Crate — Almgren-Chriss Optimal Execution

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)

Direct Exchange Connectivity (Nasdaq + NYSE)

Native co-location-grade connectivity to both US primary listing venues — the exchanges' own binary protocols, implemented from the published specifications. No vendor SDK, no REST polling. 294 unit tests across four crates.

📄 Full documentation: docs/DIRECT_EXCHANGE_CONNECTIVITY.md

Nasdaq (Carteret, NJ) NYSE / ICE Pillar (Mahwah, NJ)
Market data TotalView-ITCH 5.0 — all 22 message types XDP Integrated Feed — types 100–114 + 223
Transport MoldUDP64 multicast · SoupBinTCP 3.00 UDP multicast, A/B line arbitration
Recovery Re-request server · GLIMPSE snapshot Pillar Request Server — retransmit + refresh
Order entry OUCH 4.2 over SoupBinTCP Pillar Binary Gateway · Pillar FIX 4.2
Byte order Big endian, space-padded Little endian, NUL-padded
exchange-core   Wire primitives · exact fixed-point Price · L3 order book · gap tracker · tick-to-trade latency
   ├─ nasdaq    ITCH 5.0 · OUCH 4.2 · SoupBinTCP · MoldUDP64
   ├─ nyse      XDP packet/common/Integrated · Request Server · Pillar Binary · Pillar FIX 4.2
   └─ exchange  MarketDataSource + ExecutionGateway adapters · config · colo preflight · replay

Exact prices, never floats — every venue scales prices differently (ITCH 4 decimals, Pillar gateway 8, XDP a per-symbol PriceScaleCode). All normalise to one i64 at 1e-9 USD, so every conversion is an exact integer multiply and tick arithmetic stays associative.

Level 3 order book — order-by-order, shared by both venues. An event referencing an unknown order id reports UnknownOrder and does not mutate the book: on a live feed that means a dropped packet, and the only correct response is state recovery, never a guess.

Gap detection that refuses to skip — shared sequence tracker classifies every packet (in-order / duplicate / partial overlap / gap), splits wide gaps to respect the venue's request limit, and treats heartbeats as gap evidence since they carry the next-expected sequence. A gap with no configured recovery path ends the session rather than publishing a book with a hole in it.

A/B line arbitration — NYSE's redundant multicast lines share one tracker, so the first copy wins and the second is a duplicate by construction. ChannelStats reports the first-arrival split between lines, which is how you find a consistently slower path.

Co-location preflight — measures TCP RTT, multicast join on the intended NIC, monotonic clock resolution, and CPU budget against a LatencyBudget. A check that cannot run here reports Skipped, never Pass.

Capture replay — recorded datagrams through the same decoders, book builders and normalisers as the live path, so a book builder can be validated and an incident reproduced without an entitlement.

Fail-closed by design. Nothing here fabricates market data, simulates a session, or defaults a value

Description taken from the repository README.

Ratings

–
0 ratings
5 0
4 0
3 0
2 0
1 0

Rate this app

Sign in to rate

Comments 0

Sign in to comment

No comments yet.

Related apps

#trading · #rust · #finance