# dobrinsm/darwin architecture

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

- Interactive diagram: https://gitdiagram.com/dobrinsm/darwin
- Repository: https://github.com/dobrinsm/darwin

## Overview

DARWIN ingests market and sentiment events, mines JSON strategy hypotheses, validates and evaluates them through a walk-forward gauntlet, optionally searches parameters for MUTATE verdicts, and paper-trades promoted strategies in its arena. The orchestrator owns the recurring workflow; the dashboard and daily digest expose results. Several subsystem links are supported by README documentation or the SOURCE INDEX rather than complete excerpts, so unsampled internal details are not expanded.

Main entry points: [`orchestrator.py`](https://github.com/dobrinsm/darwin/blob/main/orchestrator.py) (Heartbeat orchestrator), [`darwin/gauntlet.py`](https://github.com/dobrinsm/darwin/blob/main/darwin/gauntlet.py) (Walk-forward gauntlet), [`darwin/arena.py`](https://github.com/dobrinsm/darwin/blob/main/darwin/arena.py) (Paper-trading arena), [`darwin/bus.py`](https://github.com/dobrinsm/darwin/blob/main/darwin/bus.py) (Point-in-time event bus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Data ingestion"]
  node_collectors["Feed collectors<br/>[collectors.py]"]
  node_backfill["History backfill<br/>[backfill.py]"]
  node_eventbus[("Point-in-time event bus<br/>[bus.py]")]
end

subgraph group_research["Strategy research"]
  node_orchestrator["Heartbeat orchestrator<br/>[orchestrator.py]"]
  node_miner["LLM strategy miner<br/>[miner.py]"]
  node_schema["Strategy spec contract<br/>[spec_schema.py]"]
  node_specs["Strategy population"]
  node_engine["Backtest engine<br/>[engine.py]"]
  node_gauntlet["Walk-forward gauntlet<br/>[gauntlet.py]"]
  node_optimizer["Mutation optimizer<br/>[optimizer.py]"]
end

subgraph group_paper["Paper trading"]
  node_arena["Paper-trading arena<br/>[arena.py]"]
  node_paperbook[("Virtual book and trade log<br/>[arena.py]")]
end

subgraph group_visibility["Operations and reporting"]
  node_dashboard["Status dashboard<br/>[dashboard.py]"]
  node_digest["Daily digest<br/>[digest.py]"]
end

node_feeds(("Market data feeds"))
node_operator(("Operator"))

node_feeds -->|"supply data"| node_collectors
node_collectors -->|"publish events"| node_eventbus
node_backfill -->|"load history"| node_eventbus
node_orchestrator -->|"runs collection"| node_collectors
node_orchestrator -->|"runs mining"| node_miner
node_orchestrator -->|"runs evaluation"| node_gauntlet
node_orchestrator -->|"runs mutations"| node_optimizer
node_orchestrator -->|"steps arena"| node_arena
node_miner -->|"reads snapshot"| node_eventbus
node_miner -->|"validates proposals"| node_schema
node_miner -->|"saves specs"| node_specs
node_gauntlet -->|"evaluates specs"| node_engine
node_gauntlet -->|"loads market data"| node_eventbus
node_gauntlet -->|"judges population"| node_specs
node_optimizer -->|"tests candidates"| node_gauntlet
node_optimizer -->|"persists children"| node_specs
node_arena -->|"compiles signals"| node_engine
node_arena -->|"reads events"| node_eventbus
node_arena -->|"records positions"| node_paperbook
node_dashboard -->|"reads live specs"| node_arena
node_operator -->|"views status"| node_dashboard
node_operator -->|"reads summary"| node_digest

click node_collectors "https://github.com/dobrinsm/darwin/blob/main/darwin/collectors.py"
click node_backfill "https://github.com/dobrinsm/darwin/blob/main/darwin/backfill.py"
click node_eventbus "https://github.com/dobrinsm/darwin/blob/main/darwin/bus.py"
click node_orchestrator "https://github.com/dobrinsm/darwin/blob/main/orchestrator.py"
click node_miner "https://github.com/dobrinsm/darwin/blob/main/darwin/miner.py"
click node_schema "https://github.com/dobrinsm/darwin/blob/main/darwin/spec_schema.py"
click node_specs "https://github.com/dobrinsm/darwin/tree/main/specs"
click node_engine "https://github.com/dobrinsm/darwin/blob/main/darwin/engine.py"
click node_gauntlet "https://github.com/dobrinsm/darwin/blob/main/darwin/gauntlet.py"
click node_optimizer "https://github.com/dobrinsm/darwin/blob/main/darwin/optimizer.py"
click node_arena "https://github.com/dobrinsm/darwin/blob/main/darwin/arena.py"
click node_paperbook "https://github.com/dobrinsm/darwin/blob/main/darwin/arena.py"
click node_dashboard "https://github.com/dobrinsm/darwin/blob/main/darwin/dashboard.py"
click node_digest "https://github.com/dobrinsm/darwin/blob/main/digest.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_collectors,node_backfill,node_eventbus toneBlue
class node_orchestrator,node_miner,node_schema,node_specs,node_engine,node_gauntlet,node_optimizer toneAmber
class node_arena,node_paperbook toneMint
class node_dashboard,node_digest toneRose
class node_feeds,node_operator toneIndigo
```

## Components

### Data ingestion

- [Feed collectors](https://github.com/dobrinsm/darwin/blob/main/darwin/collectors.py): `darwin/collectors.py`
- [History backfill](https://github.com/dobrinsm/darwin/blob/main/darwin/backfill.py): `darwin/backfill.py`
- [Point-in-time event bus](https://github.com/dobrinsm/darwin/blob/main/darwin/bus.py): `darwin/bus.py`

### Strategy research

- [Heartbeat orchestrator](https://github.com/dobrinsm/darwin/blob/main/orchestrator.py): `orchestrator.py`
- [LLM strategy miner](https://github.com/dobrinsm/darwin/blob/main/darwin/miner.py): `darwin/miner.py`
- [Strategy spec contract](https://github.com/dobrinsm/darwin/blob/main/darwin/spec_schema.py): `darwin/spec_schema.py`
- [Strategy population](https://github.com/dobrinsm/darwin/tree/main/specs): `specs`
- [Backtest engine](https://github.com/dobrinsm/darwin/blob/main/darwin/engine.py): `darwin/engine.py`
- [Walk-forward gauntlet](https://github.com/dobrinsm/darwin/blob/main/darwin/gauntlet.py): `darwin/gauntlet.py`
- [Mutation optimizer](https://github.com/dobrinsm/darwin/blob/main/darwin/optimizer.py): `darwin/optimizer.py`

### Paper trading

- [Paper-trading arena](https://github.com/dobrinsm/darwin/blob/main/darwin/arena.py): `darwin/arena.py`
- [Virtual book and trade log](https://github.com/dobrinsm/darwin/blob/main/darwin/arena.py): `darwin/arena.py`

### Operations and reporting

- [Status dashboard](https://github.com/dobrinsm/darwin/blob/main/darwin/dashboard.py): `darwin/dashboard.py`
- [Daily digest](https://github.com/dobrinsm/darwin/blob/main/digest.py): `digest.py`

### Other components

- **Market data feeds**
- **Operator**

## Connections

- Market data feeds → Feed collectors: supply data (evidence: `README.md`)
- Feed collectors → Point-in-time event bus: publish events (evidence: `darwin/collectors.py`)
- History backfill → Point-in-time event bus: load history (evidence: `darwin/backfill.py`)
- Heartbeat orchestrator → Feed collectors: runs collection (evidence: `orchestrator.py`)
- Heartbeat orchestrator → LLM strategy miner: runs mining (evidence: `orchestrator.py`)
- Heartbeat orchestrator → Walk-forward gauntlet: runs evaluation (evidence: `orchestrator.py`)
- Heartbeat orchestrator → Mutation optimizer: runs mutations (evidence: `orchestrator.py`)
- Heartbeat orchestrator → Paper-trading arena: steps arena (evidence: `orchestrator.py`)
- LLM strategy miner → Point-in-time event bus: reads snapshot (evidence: `README.md`)
- LLM strategy miner → Strategy spec contract: validates proposals (evidence: `README.md`)
- LLM strategy miner → Strategy population: saves specs (evidence: `README.md`)
- Walk-forward gauntlet → Backtest engine: evaluates specs (evidence: `darwin/gauntlet.py`)
- Walk-forward gauntlet → Point-in-time event bus: loads market data (evidence: `darwin/gauntlet.py`)
- Walk-forward gauntlet → Strategy population: judges population (evidence: `README.md`)
- Mutation optimizer → Walk-forward gauntlet: tests candidates (evidence: `darwin/optimizer.py`)
- Mutation optimizer → Strategy population: persists children (evidence: `README.md`)
- Paper-trading arena → Backtest engine: compiles signals (evidence: `darwin/arena.py`)
- Paper-trading arena → Point-in-time event bus: reads events (evidence: `darwin/arena.py`)
- Paper-trading arena → Virtual book and trade log: records positions (evidence: `README.md`)
- Status dashboard → Paper-trading arena: reads live specs (evidence: `darwin/dashboard.py`)
- Operator → Status dashboard: views status (evidence: `README.md`)
- Operator → Daily digest: reads summary (evidence: `README.md`)
