# elmaxadore/the-quant architecture

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

- Interactive diagram: https://gitdiagram.com/elmaxadore/the-quant
- Repository: https://github.com/elmaxadore/the-quant

## Overview

THE QUANT is an autonomous, multi-account trading system: operators configure accounts and run the Rust binary, which selects a market feed, runs isolated Aegis desks, and journals account/trade state. A separate Python research and training stack processes historical data and exports ONNX models for Rust inference; remote Colab workers persist artifacts. The graph preserves README-described risk, update, vault, and dashboard capabilities, but sampled excerpts do not expose all their runtime call paths, so those links are omitted rather than inferred.

Main entry points: [`src/engine.rs`](https://github.com/elmaxadore/the-quant/blob/main/src/engine.rs) (Multi-Desk Engine), [`src/desk.rs`](https://github.com/elmaxadore/the-quant/blob/main/src/desk.rs) (Trading Desks), [`python/aegis_trainer/main.py`](https://github.com/elmaxadore/the-quant/blob/main/python/aegis_trainer/main.py) (Model Training), [`src/main.rs`](https://github.com/elmaxadore/the-quant/blob/main/src/main.rs) (Command Router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_live["Live Trading"]
  node_cli["Command Router<br/>[main.rs]"]
  node_config["Account Config<br/>[config.rs]"]
  node_engine["Multi-Desk Engine<br/>[engine.rs]"]
  node_feeds["Market Feeds<br/>[simfeed.rs]"]
  node_desk["Trading Desks<br/>[desk.rs]"]
  node_aegis["Aegis Strategy<br/>[aegis.rs]"]
  node_universe["Asset Universe<br/>[universe.rs]"]
  node_execution["Trade Execution<br/>[execution.rs]"]
  node_risk["Risk Controls<br/>[risk.rs]"]
  node_onnx["ONNX Inference<br/>[onnx.rs]"]
end

subgraph group_ops["Operations and State"]
  node_state[("Trade State<br/>[state.rs]")]
  node_resource["Resource Scaling<br/>[resource.rs]"]
  node_vault["Secrets Vault<br/>[security.rs]"]
  node_updater["Auto Updater<br/>[update.rs]"]
  node_dashboard["Web Dashboard<br/>[web.rs]"]
end

subgraph group_ml["Offline ML"]
  node_data["Training Data<br/>[loader.py]"]
  node_features["Feature Engineering<br/>[features.py]"]
  node_trainer["Model Training<br/>[main.py]"]
  node_export["ONNX Export<br/>[onnx_export.py]"]
end

subgraph group_research["Research Jobs"]
  node_research["Research Pipeline<br/>[train_pipeline.py]"]
  node_checkpoint[("Job Checkpoints<br/>[checkpoint.py]")]
  node_colab["Colab Bridge<br/>[colab_bridge.py]"]
  node_persistence[("Artifact Persistence<br/>[persist.py]")]
  node_ingestion["Market Ingestion<br/>[data_ingestion.py]"]
  node_insights["Unsupervised Insights"]
end

node_operator(("Operator"))

node_operator -->|"runs commands"| node_cli
node_cli -->|"runs paper mode"| node_engine
node_cli -->|"loads model"| node_onnx
node_engine -->|"selects feed"| node_feeds
node_engine -->|"creates desks"| node_desk
node_engine -->|"reads accounts"| node_config
node_engine -.->|"uses profile"| node_resource
node_desk -->|"uses strategy"| node_aegis
node_desk -->|"uses universe"| node_universe
node_desk -->|"reads rules"| node_config
node_desk -.->|"journals results"| node_state
node_operator -->|"manages secrets"| node_vault
node_operator -->|"requests updates"| node_updater
node_operator -.->|"views dashboard"| node_dashboard
node_trainer -->|"loads market data"| node_data
node_trainer -->|"builds features"| node_features
node_trainer -.->|"exports model"| node_export
node_operator -->|"starts research"| node_research
node_research -->|"uses checkpoints"| node_checkpoint
node_checkpoint -->|"uses persistence"| node_persistence
node_insights -->|"loads data"| node_ingestion
node_insights -->|"uses features"| node_features
node_colab -.->|"persists artifacts"| node_persistence

click node_cli "https://github.com/elmaxadore/the-quant/blob/main/src/main.rs"
click node_config "https://github.com/elmaxadore/the-quant/blob/main/src/config.rs"
click node_engine "https://github.com/elmaxadore/the-quant/blob/main/src/engine.rs"
click node_feeds "https://github.com/elmaxadore/the-quant/blob/main/src/simfeed.rs"
click node_desk "https://github.com/elmaxadore/the-quant/blob/main/src/desk.rs"
click node_aegis "https://github.com/elmaxadore/the-quant/blob/main/src/aegis.rs"
click node_universe "https://github.com/elmaxadore/the-quant/blob/main/src/universe.rs"
click node_execution "https://github.com/elmaxadore/the-quant/blob/main/src/execution.rs"
click node_risk "https://github.com/elmaxadore/the-quant/blob/main/src/risk.rs"
click node_onnx "https://github.com/elmaxadore/the-quant/blob/main/src/onnx.rs"
click node_state "https://github.com/elmaxadore/the-quant/blob/main/src/state.rs"
click node_resource "https://github.com/elmaxadore/the-quant/blob/main/src/resource.rs"
click node_vault "https://github.com/elmaxadore/the-quant/blob/main/src/security.rs"
click node_updater "https://github.com/elmaxadore/the-quant/blob/main/src/update.rs"
click node_dashboard "https://github.com/elmaxadore/the-quant/blob/main/src/web.rs"
click node_data "https://github.com/elmaxadore/the-quant/blob/main/python/aegis_trainer/data/loader.py"
click node_features "https://github.com/elmaxadore/the-quant/blob/main/python/aegis_trainer/data/features.py"
click node_trainer "https://github.com/elmaxadore/the-quant/blob/main/python/aegis_trainer/main.py"
click node_export "https://github.com/elmaxadore/the-quant/blob/main/python/aegis_trainer/export/onnx_export.py"
click node_research "https://github.com/elmaxadore/the-quant/blob/main/python/research/train_pipeline.py"
click node_checkpoint "https://github.com/elmaxadore/the-quant/blob/main/python/research/checkpoint.py"
click node_colab "https://github.com/elmaxadore/the-quant/blob/main/colab/colab_bridge.py"
click node_persistence "https://github.com/elmaxadore/the-quant/blob/main/colab/persist.py"
click node_ingestion "https://github.com/elmaxadore/the-quant/blob/main/python_training/data_ingestion.py"
click node_insights "https://github.com/elmaxadore/the-quant/blob/main/python/unsupervised_insights.py"

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_cli,node_config,node_engine,node_feeds,node_desk,node_aegis,node_universe,node_execution,node_risk,node_onnx toneBlue
class node_state,node_resource,node_vault,node_updater,node_dashboard toneAmber
class node_data,node_features,node_trainer,node_export toneMint
class node_research,node_checkpoint,node_colab,node_persistence,node_ingestion,node_insights toneRose
class node_operator toneIndigo
```

## Components

### Live Trading

- [Command Router](https://github.com/elmaxadore/the-quant/blob/main/src/main.rs): `src/main.rs`
- [Account Config](https://github.com/elmaxadore/the-quant/blob/main/src/config.rs): `src/config.rs`
- [Multi-Desk Engine](https://github.com/elmaxadore/the-quant/blob/main/src/engine.rs): `src/engine.rs`
- [Market Feeds](https://github.com/elmaxadore/the-quant/blob/main/src/simfeed.rs): `src/simfeed.rs`
- [Trading Desks](https://github.com/elmaxadore/the-quant/blob/main/src/desk.rs): `src/desk.rs`
- [Aegis Strategy](https://github.com/elmaxadore/the-quant/blob/main/src/aegis.rs): `src/aegis.rs`
- [Asset Universe](https://github.com/elmaxadore/the-quant/blob/main/src/universe.rs): `src/universe.rs`
- [Trade Execution](https://github.com/elmaxadore/the-quant/blob/main/src/execution.rs): `src/execution.rs`
- [Risk Controls](https://github.com/elmaxadore/the-quant/blob/main/src/risk.rs): `src/risk.rs`
- [ONNX Inference](https://github.com/elmaxadore/the-quant/blob/main/src/onnx.rs): `src/onnx.rs`

### Operations and State

- [Trade State](https://github.com/elmaxadore/the-quant/blob/main/src/state.rs): `src/state.rs`
- [Resource Scaling](https://github.com/elmaxadore/the-quant/blob/main/src/resource.rs): `src/resource.rs`
- [Secrets Vault](https://github.com/elmaxadore/the-quant/blob/main/src/security.rs): `src/security.rs`
- [Auto Updater](https://github.com/elmaxadore/the-quant/blob/main/src/update.rs): `src/update.rs`
- [Web Dashboard](https://github.com/elmaxadore/the-quant/blob/main/src/web.rs): `src/web.rs`

### Offline ML

- [Training Data](https://github.com/elmaxadore/the-quant/blob/main/python/aegis_trainer/data/loader.py): `python/aegis_trainer/data/loader.py`
- [Feature Engineering](https://github.com/elmaxadore/the-quant/blob/main/python/aegis_trainer/data/features.py): `python/aegis_trainer/data/features.py`
- [Model Training](https://github.com/elmaxadore/the-quant/blob/main/python/aegis_trainer/main.py): `python/aegis_trainer/main.py`
- [ONNX Export](https://github.com/elmaxadore/the-quant/blob/main/python/aegis_trainer/export/onnx_export.py): `python/aegis_trainer/export/onnx_export.py`

### Research Jobs

- [Research Pipeline](https://github.com/elmaxadore/the-quant/blob/main/python/research/train_pipeline.py): `python/research/train_pipeline.py`
- [Job Checkpoints](https://github.com/elmaxadore/the-quant/blob/main/python/research/checkpoint.py): `python/research/checkpoint.py`
- [Colab Bridge](https://github.com/elmaxadore/the-quant/blob/main/colab/colab_bridge.py): `colab/colab_bridge.py`
- [Artifact Persistence](https://github.com/elmaxadore/the-quant/blob/main/colab/persist.py): `colab/persist.py`
- [Market Ingestion](https://github.com/elmaxadore/the-quant/blob/main/python_training/data_ingestion.py): `python_training/data_ingestion.py`
- [Unsupervised Insights](https://github.com/elmaxadore/the-quant/blob/main/python/unsupervised_insights.py): `python/unsupervised_insights.py`

### Other components

- **Operator**

## Connections

- Operator → Command Router: runs commands
- Command Router → Multi-Desk Engine: runs paper mode (evidence: `src/main.rs`)
- Command Router → ONNX Inference: loads model (evidence: `src/main.rs`)
- Multi-Desk Engine → Market Feeds: selects feed (evidence: `src/engine.rs`)
- Multi-Desk Engine → Trading Desks: creates desks (evidence: `src/engine.rs`)
- Multi-Desk Engine → Account Config: reads accounts (evidence: `src/engine.rs`)
- Multi-Desk Engine → Resource Scaling: uses profile (evidence: `src/engine.rs`)
- Trading Desks → Aegis Strategy: uses strategy (evidence: `src/desk.rs`)
- Trading Desks → Asset Universe: uses universe (evidence: `src/desk.rs`)
- Trading Desks → Account Config: reads rules (evidence: `src/desk.rs`)
- Trading Desks → Trade State: journals results (evidence: `src/desk.rs`)
- Operator → Secrets Vault: manages secrets
- Operator → Auto Updater: requests updates
- Operator → Web Dashboard: views dashboard
- Model Training → Training Data: loads market data (evidence: `python/aegis_trainer/main.py`)
- Model Training → Feature Engineering: builds features (evidence: `python/aegis_trainer/main.py`)
- Model Training → ONNX Export: exports model
- Operator → Research Pipeline: starts research (evidence: `python/research/train_pipeline.py`)
- Research Pipeline → Job Checkpoints: uses checkpoints (evidence: `python/research/train_pipeline.py`)
- Job Checkpoints → Artifact Persistence: uses persistence (evidence: `python/research/checkpoint.py`)
- Unsupervised Insights → Market Ingestion: loads data (evidence: `python/unsupervised_insights.py`)
- Unsupervised Insights → Feature Engineering: uses features (evidence: `python/unsupervised_insights.py`)
- Colab Bridge → Artifact Persistence: persists artifacts
