百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rust-finance

> 编程语言
开源

一个高性能、超低延迟的交易终端和基于 AI 的守护程序,完全由 Rust 构建。

380 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个高性能、超低延迟的交易终端和基于 AI 的守护程序,完全由 Rust 构建。

RustFinance Terminal (rust-finance)


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.

  • Try it locally: cargo run -p tui --release
  • Run the daemon: USE_MOCK=1 cargo run -p daemon --release
  • Live crypto, no API key: USE_MOCK=0 SYMBOLS_CRYPTO=BTCUSDT,ETHUSDT cargo run -p daemon --release — Binance's public WebSocket needs no credentials, so this is the shortest path to real market data flowing through the full pipeline
  • Demo: https://github.com/user-attachments/assets/c769b2c2-cfa0-44bd-a261-99786ea653e1
  • Community: Roadmap, Contributing, good first issues
  • Direct exchange connectivity: Nasdaq ITCH/OUCH + NYSE Pillar — native binary protocols, 294 tests
  • Latency measurement: docs/latency.md — the tick-to-trade model, what instrumentation costs, and which stages are still not wired
  • Databento: docs/databento.md — live source for Nasdaq/NYSE/CME/OPRA without exchange ports, plus measured latency and entitlement reality
  • Research Paper: RustFinance Research Paper 2026 (PDF) — 1,400+ line LaTeX paper covering architecture, 18 research papers, quantitative models, and benchmarks
  • Funding: GitHub Sponsors, Buy Me a Coffee, funding.json
  • Recognition: Listed in awesome-rust Finance applications

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

Table of Contents

  • Overview
  • Architecture
  • Direct Exchange Connectivity
  • Quick Start
  • Roadmap
  • Contributing
  • Features
  • TUI Hotkeys
  • Performance
  • Configuration
  • Strategy Development
  • API Reference
  • Troubleshooting
  • License and Disclaimer

Architecture

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

…

Crate Map

…

Signals Crate — 2026 Quant Alpha Library

Based on 18 research papers (2025–2026). 55 unit tests.

…

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 only an exchange can issue. An unconfigured connector refuses to start and names what it lacks. Encoders exist for round-trip tests and capture tooling only, and are never wired into a feed path.


Quick Start

bash
# 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

Features

Core Engine

  • Hybrid Intelligence Pipeline — Quant, Swarm, Knowledge Graph, Dexter AI, Risk Gate, Execution
  • Nanosecond-precision timestamps (UnixNanos) with monotonic SequenceId ordering
  • Swappable clock — RealtimeClock for live trading, DeterministicClock for backtesting
  • Event-driven architecture with typed Envelope wrapping every system event
  • Deterministic Safety Gate — zero-AI verification layer preventing agent confirmation bias
  • 34-crate workspace compiling in ~17s

Market Data

  • Nasdaq TotalView-ITCH 5.0 — full order-by-order depth, all 22 message types, over MoldUDP64 multicast or SoupBinTCP
    • Stock-locate filtering before field decode — a 20-symbol strategy discards >99% of the tape for free
    • Symbol directory rebuilt per session (locate codes are reassigned daily), test/demo issues flagged non-production
    • Non-printable executions excluded from volume, so cross prints are never double counted
  • NYSE Pillar XDP Integrated Feed — full depth, message types 100–114 plus Stock Summary, dual multicast lines
    • Per-symbol PriceScaleCode applied before any price is interpreted — messages that arrive ahead of their mapping are counted and dropped, never decoded at a guessed scale
    • Source Time Reference reassembly (data messages carry only nanoseconds; the seconds arrive once a second per matching-engine partition)
    • Symbol Clear + refresh sequences handled, resuming the live channel at the snapshot's LastSeqNum
  • Alpaca — Real-time US equities via WebSocket (5 feeds: IEX, SIP, BOATS, Delayed, Overnight)
  • Binance — Crypto streams (trades, bookTicker, kline, depth5) via combined WS endpoint
    • Live Candlestick Feed — Direct WebSocket kline_1m stream → real-time OHLCV candlestick rendering in TUI
    • Gap Detection Engine — Sequence-based WebSocket gap detector with configurable thresholds (small gap: retransmit, medium: snapshot, large: failover)
  • Finnhub — Global market data (incl. NSE/BSE) and live trades via WebSocket
  • Polymarket — Prediction market data via 3 APIs:
    • Gamma API — Events, markets, tags, search, profiles (gamma-api.polymarket.com)
    • CLOB API

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustaialgorithmic-tradingfinanceratatui

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言