# ashutosh0x/rust-finance architecture

> Architecture diagram of the GitHub repository ashutosh0x/rust-finance, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashutosh0x/rust-finance
- Repository: https://github.com/ashutosh0x/rust-finance

## Overview

RustFinance Terminal is a multi-crate trading terminal and research platform. Its live workflow consumes market events, runs a strategy, checks risk, submits eligible orders, and publishes updates to the terminal dashboard. Separate capabilities provide quantitative analysis and AI-assisted signals, backtesting, compliance, persistence, alerts, and direct exchange connectivity. The sampled daemon engine supports the live-loop relationships; the hybrid pipeline describes additional stages, but its execution call is commented out. Some subsystem links are omitted where the available excerpts do not establish runtime wiring.

Main entry points: [`crates/daemon/src/engine.rs`](https://github.com/ashutosh0x/rust-finance/blob/main/crates/daemon/src/engine.rs) (Daemon Engine), [`crates/daemon/src/hybrid_pipeline.rs`](https://github.com/ashutosh0x/rust-finance/blob/main/crates/daemon/src/hybrid_pipeline.rs) (Intelligence Pipeline), [`crates/daemon/src/strategy.rs`](https://github.com/ashutosh0x/rust-finance/blob/main/crates/daemon/src/strategy.rs) (Strategy), [`crates/ingestion/src/service.rs`](https://github.com/ashutosh0x/rust-finance/blob/main/crates/ingestion/src/service.rs) (Market Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_market["Market Connectivity"]
  node_ingestion["Market Ingestion<br/>[service.rs]"]
  node_exchange_connectivity["Exchange Protocols<br/>[lib.rs]"]
end

subgraph group_runtime["Trading Runtime"]
  node_daemon_engine["Daemon Engine<br/>[engine.rs]"]
  node_strategy["Strategy<br/>[strategy.rs]"]
  node_execution["Order Execution<br/>[gateway.rs]"]
  node_oms["Order Management<br/>[lib.rs]"]
end

subgraph group_analysis["Quant &amp; Research"]
  node_quant_models["Quant Models<br/>[lib.rs]"]
  node_signals["Signals<br/>[lib.rs]"]
  node_hybrid_pipeline["Intelligence Pipeline<br/>[hybrid_pipeline.rs]"]
  node_swarm["Swarm Simulation<br/>[engine.rs]"]
  node_knowledge_graph["Knowledge Graph<br/>[graph.rs]"]
  node_ai_analysis["AI Analysis<br/>[dexter.rs]"]
  node_backtest["Backtesting<br/>[engine.rs]"]
end

subgraph group_interfaces["User Interfaces"]
  node_tui["Terminal Dashboard<br/>[main.rs]"]
  node_web_dashboard["Web Dashboard<br/>[lib.rs]"]
end

subgraph group_controls["Controls &amp; State"]
  node_risk["Risk Controls<br/>[gate.rs]"]
  node_persistence[("Persistence<br/>[lib.rs]")]
  node_compliance["Compliance<br/>[lib.rs]"]
  node_alerts["Alert Routing<br/>[engine.rs]"]
end

node_trader(("Trader"))
node_market_venues(("Market Venues"))
node_broker(("Broker"))

node_trader -->|"operates"| node_tui
node_market_venues -->|"streams data"| node_ingestion
node_market_venues -.->|"feeds protocols"| node_exchange_connectivity
node_ingestion -->|"supplies events"| node_daemon_engine
node_daemon_engine -->|"runs strategy"| node_strategy
node_daemon_engine -->|"checks orders"| node_risk
node_daemon_engine -->|"submits orders"| node_execution
node_execution -->|"routes orders"| node_broker
node_daemon_engine -->|"sends updates"| node_tui
node_daemon_engine -.->|"records state"| node_persistence
node_hybrid_pipeline -->|"uses simulation"| node_swarm
node_hybrid_pipeline -->|"uses context"| node_knowledge_graph
node_hybrid_pipeline -->|"requests analysis"| node_ai_analysis
node_hybrid_pipeline -->|"checks verdict"| node_risk
node_quant_models -.->|"provides measures"| node_hybrid_pipeline
node_signals -.->|"informs signals"| node_strategy
node_backtest -.->|"replays strategy"| node_strategy
node_compliance -.->|"governs trading"| node_daemon_engine
node_alerts -.->|"sends notifications"| node_trader
node_oms -.->|"stores records"| node_persistence
node_web_dashboard -.->|"presents state"| node_daemon_engine

click node_ingestion "https://github.com/ashutosh0x/rust-finance/blob/main/crates/ingestion/src/service.rs"
click node_exchange_connectivity "https://github.com/ashutosh0x/rust-finance/blob/main/crates/exchange/src/lib.rs"
click node_daemon_engine "https://github.com/ashutosh0x/rust-finance/blob/main/crates/daemon/src/engine.rs"
click node_strategy "https://github.com/ashutosh0x/rust-finance/blob/main/crates/daemon/src/strategy.rs"
click node_risk "https://github.com/ashutosh0x/rust-finance/blob/main/crates/risk/src/gate.rs"
click node_execution "https://github.com/ashutosh0x/rust-finance/blob/main/crates/execution/src/gateway.rs"
click node_oms "https://github.com/ashutosh0x/rust-finance/blob/main/crates/oms/src/lib.rs"
click node_persistence "https://github.com/ashutosh0x/rust-finance/blob/main/crates/persistence/src/lib.rs"
click node_tui "https://github.com/ashutosh0x/rust-finance/blob/main/crates/tui/src/main.rs"
click node_web_dashboard "https://github.com/ashutosh0x/rust-finance/blob/main/crates/web-dashboard/src/lib.rs"
click node_quant_models "https://github.com/ashutosh0x/rust-finance/blob/main/crates/pricing/src/lib.rs"
click node_signals "https://github.com/ashutosh0x/rust-finance/blob/main/crates/signals/src/lib.rs"
click node_hybrid_pipeline "https://github.com/ashutosh0x/rust-finance/blob/main/crates/daemon/src/hybrid_pipeline.rs"
click node_swarm "https://github.com/ashutosh0x/rust-finance/blob/main/crates/swarm_sim/src/engine.rs"
click node_knowledge_graph "https://github.com/ashutosh0x/rust-finance/blob/main/crates/knowledge_graph/src/graph.rs"
click node_ai_analysis "https://github.com/ashutosh0x/rust-finance/blob/main/crates/ai/src/dexter.rs"
click node_backtest "https://github.com/ashutosh0x/rust-finance/blob/main/crates/backtest/src/engine.rs"
click node_compliance "https://github.com/ashutosh0x/rust-finance/blob/main/crates/compliance/src/lib.rs"
click node_alerts "https://github.com/ashutosh0x/rust-finance/blob/main/crates/alerts/src/engine.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ingestion,node_exchange_connectivity toneBlue
class node_daemon_engine,node_strategy,node_execution,node_oms toneAmber
class node_quant_models,node_signals,node_hybrid_pipeline,node_swarm,node_knowledge_graph,node_ai_analysis,node_backtest toneMint
class node_tui,node_web_dashboard toneRose
class node_risk,node_persistence,node_compliance,node_alerts,node_trader,node_market_venues,node_broker toneIndigo
```

## Components

### Market Connectivity

- [Market Ingestion](https://github.com/ashutosh0x/rust-finance/blob/main/crates/ingestion/src/service.rs): `crates/ingestion/src/service.rs`
- [Exchange Protocols](https://github.com/ashutosh0x/rust-finance/blob/main/crates/exchange/src/lib.rs): `crates/exchange/src/lib.rs`

### Trading Runtime

- [Daemon Engine](https://github.com/ashutosh0x/rust-finance/blob/main/crates/daemon/src/engine.rs): `crates/daemon/src/engine.rs`
- [Strategy](https://github.com/ashutosh0x/rust-finance/blob/main/crates/daemon/src/strategy.rs): `crates/daemon/src/strategy.rs`
- [Order Execution](https://github.com/ashutosh0x/rust-finance/blob/main/crates/execution/src/gateway.rs): `crates/execution/src/gateway.rs`
- [Order Management](https://github.com/ashutosh0x/rust-finance/blob/main/crates/oms/src/lib.rs): `crates/oms/src/lib.rs`

### Quant & Research

- [Quant Models](https://github.com/ashutosh0x/rust-finance/blob/main/crates/pricing/src/lib.rs): `crates/pricing/src/lib.rs`
- [Signals](https://github.com/ashutosh0x/rust-finance/blob/main/crates/signals/src/lib.rs): `crates/signals/src/lib.rs`
- [Intelligence Pipeline](https://github.com/ashutosh0x/rust-finance/blob/main/crates/daemon/src/hybrid_pipeline.rs): `crates/daemon/src/hybrid_pipeline.rs`
- [Swarm Simulation](https://github.com/ashutosh0x/rust-finance/blob/main/crates/swarm_sim/src/engine.rs): `crates/swarm_sim/src/engine.rs`
- [Knowledge Graph](https://github.com/ashutosh0x/rust-finance/blob/main/crates/knowledge_graph/src/graph.rs): `crates/knowledge_graph/src/graph.rs`
- [AI Analysis](https://github.com/ashutosh0x/rust-finance/blob/main/crates/ai/src/dexter.rs): `crates/ai/src/dexter.rs`
- [Backtesting](https://github.com/ashutosh0x/rust-finance/blob/main/crates/backtest/src/engine.rs): `crates/backtest/src/engine.rs`

### User Interfaces

- [Terminal Dashboard](https://github.com/ashutosh0x/rust-finance/blob/main/crates/tui/src/main.rs): `crates/tui/src/main.rs`
- [Web Dashboard](https://github.com/ashutosh0x/rust-finance/blob/main/crates/web-dashboard/src/lib.rs): `crates/web-dashboard/src/lib.rs`

### Controls & State

- [Risk Controls](https://github.com/ashutosh0x/rust-finance/blob/main/crates/risk/src/gate.rs): `crates/risk/src/gate.rs`
- [Persistence](https://github.com/ashutosh0x/rust-finance/blob/main/crates/persistence/src/lib.rs): `crates/persistence/src/lib.rs`
- [Compliance](https://github.com/ashutosh0x/rust-finance/blob/main/crates/compliance/src/lib.rs): `crates/compliance/src/lib.rs`
- [Alert Routing](https://github.com/ashutosh0x/rust-finance/blob/main/crates/alerts/src/engine.rs): `crates/alerts/src/engine.rs`

### Other components

- **Trader**
- **Market Venues**
- **Broker**

## Connections

- Trader → Terminal Dashboard: operates
- Market Venues → Market Ingestion: streams data
- Market Venues → Exchange Protocols: feeds protocols
- Market Ingestion → Daemon Engine: supplies events
- Daemon Engine → Strategy: runs strategy
- Daemon Engine → Risk Controls: checks orders
- Daemon Engine → Order Execution: submits orders
- Order Execution → Broker: routes orders
- Daemon Engine → Terminal Dashboard: sends updates
- Daemon Engine → Persistence: records state
- Intelligence Pipeline → Swarm Simulation: uses simulation
- Intelligence Pipeline → Knowledge Graph: uses context
- Intelligence Pipeline → AI Analysis: requests analysis
- Intelligence Pipeline → Risk Controls: checks verdict
- Quant Models → Intelligence Pipeline: provides measures
- Signals → Strategy: informs signals
- Backtesting → Strategy: replays strategy
- Compliance → Daemon Engine: governs trading
- Alert Routing → Trader: sends notifications
- Order Management → Persistence: stores records
- Web Dashboard → Daemon Engine: presents state
