# erenpattern/darwinex architecture

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

- Interactive diagram: https://gitdiagram.com/erenpattern/darwinex
- Repository: https://github.com/erenpattern/darwinex

## Overview

Darwinex is a research lab with two independent workflows: PMM paper-trading observation and analysis, and XARB market-data capture, arbitrage evaluation, and reconciliation. PMM collects Hummingbot observations, assesses reliability, and supports shadow decisions and quantitative research; its dashboard is read-only. XARB fetches public Coinbase/Kraken books, evaluates opportunities in shadow/replay mode, and records results. Source excerpts establish several internal calls; README statements support documented capabilities whose wiring was not sampled. No live trading workflow is represented.

Main entry points: [`pmm/monitoring/decision_arbiter.py`](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/decision_arbiter.py) (Decision arbiter), [`pmm/monitoring/paper_temporal_collector.py`](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_temporal_collector.py) (Temporal collector), [`xarb/feeds.py`](https://github.com/erenpattern/darwinex/blob/main/xarb/feeds.py) (Feed adapters), [`pmm/monitoring/reliability_kernel.py`](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/reliability_kernel.py) (Reliability kernel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pmm_ops["PMM Monitoring"]
  node_pmm_config["Paper configuration"]
  node_collector["Temporal collector"]
  node_observations[("Observation store")]
  node_reliability["Reliability kernel"]
  node_arbiter["Decision arbiter"]
  node_paper_reconcile["Paper reconciliation<br/>[paper_reconcile.py]"]
  node_pmm_ledger[("Reconciliation ledger<br/>[paper_reconcile.py]")]
  node_capability_audit["Capability audit"]
  node_phase_audit["Phase audit<br/>[phase_audit.py]"]
  node_supervisor["Paper supervisor"]
  node_observability["Observability supervisor"]
  node_snapshot["Paper snapshot<br/>[paper_snapshot.py]"]
  node_daily_reports["Daily reports"]
  node_pmm_dashboard["Read-only dashboard<br/>[server.py]"]
end

subgraph group_pmm_research["PMM Research"]
  node_quant_pipeline["Quant pipeline<br/>[quant_pipeline.py]"]
  node_baseline_eval["Baseline evaluation"]
  node_replay["Captured replay<br/>[replay_captured.py]"]
  node_walk_forward["Walk-forward analysis"]
  node_promotion["Promotion gate<br/>[promotion_gate.py]"]
  node_divergence["Divergence analysis"]
  node_regime["Regime analysis<br/>[regime_analysis.py]"]
  node_experimental_backtest["Experimental backtest"]
  node_adaptive_shadow["Adaptive shadow run"]
end

subgraph group_xarb["XARB Lab"]
  node_capture_runner["Capture runner<br/>[run_capture.py]"]
  node_feeds["Feed adapters<br/>[feeds.py]"]
  node_xarb_engine["Arbitrage engine<br/>[engine.py]"]
  node_xarb_ledger[("Append-only ledger<br/>[engine.py]")]
  node_xarb_reconcile["Capture reconciliation<br/>[reconcile.py]"]
  node_xarb_cli["Replay CLI<br/>[cli.py]"]
end

node_hummingbot(("Hummingbot paper bot"))
node_dashboard_user(("Dashboard viewer"))
node_researcher(("Researcher"))
node_coinbase(("Coinbase public API"))
node_kraken(("Kraken public API"))

node_hummingbot -.->|"provides observations"| node_collector
node_pmm_config -.->|"configures paper bot"| node_hummingbot
node_collector -->|"writes observations"| node_observations
node_collector -->|"assesses health"| node_reliability
node_collector -->|"initializes decision schema"| node_arbiter
node_paper_reconcile -->|"writes ledger"| node_pmm_ledger
node_paper_reconcile -->|"uses decision contract"| node_arbiter
node_paper_reconcile -->|"uses health checks"| node_reliability
node_arbiter -->|"assesses health"| node_reliability
node_adaptive_shadow -->|"assesses health"| node_reliability
node_adaptive_shadow -->|"builds decisions"| node_arbiter
node_walk_forward -.->|"uses ensemble"| node_arbiter
node_dashboard_user -.->|"views status"| node_pmm_dashboard
node_researcher -.->|"runs research"| node_quant_pipeline
node_coinbase -->|"supplies order book"| node_feeds
node_kraken -->|"supplies order book"| node_feeds
node_capture_runner -->|"captures feeds"| node_feeds
node_capture_runner -->|"runs reconciliation"| node_xarb_reconcile
node_feeds -->|"validates opportunity"| node_xarb_engine
node_xarb_engine -->|"appends events"| node_xarb_ledger
node_xarb_cli -->|"replays quotes"| node_xarb_engine

click node_pmm_config "https://github.com/erenpattern/darwinex/blob/main/pmm/hummingbot/conf/strategies/conf_btc_usdt_paper_v1.yml"
click node_collector "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_temporal_collector.py"
click node_observations "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_temporal_collector.py"
click node_reliability "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/reliability_kernel.py"
click node_arbiter "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/decision_arbiter.py"
click node_paper_reconcile "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_reconcile.py"
click node_pmm_ledger "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_reconcile.py"
click node_capability_audit "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/capability_audit.py"
click node_phase_audit "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/phase_audit.py"
click node_supervisor "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_supervisor.py"
click node_observability "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/observability_supervisor.py"
click node_snapshot "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_snapshot.py"
click node_daily_reports "https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/generate_daily_reports.py"
click node_pmm_dashboard "https://github.com/erenpattern/darwinex/blob/main/pmm/dashboard/server.py"
click node_quant_pipeline "https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/quant_pipeline.py"
click node_baseline_eval "https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/baseline_evaluation.py"
click node_replay "https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/replay_captured.py"
click node_walk_forward "https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/walk_forward_captured.py"
click node_promotion "https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/promotion_gate.py"
click node_divergence "https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/divergence_analysis.py"
click node_regime "https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/regime_analysis.py"
click node_experimental_backtest "https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/experimental_pmm_backtest.py"
click node_adaptive_shadow "https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/shadow_adaptive_pmm.py"
click node_capture_runner "https://github.com/erenpattern/darwinex/blob/main/xarb/run_capture.py"
click node_feeds "https://github.com/erenpattern/darwinex/blob/main/xarb/feeds.py"
click node_xarb_engine "https://github.com/erenpattern/darwinex/blob/main/xarb/engine.py"
click node_xarb_ledger "https://github.com/erenpattern/darwinex/blob/main/xarb/engine.py"
click node_xarb_reconcile "https://github.com/erenpattern/darwinex/blob/main/xarb/reconcile.py"
click node_xarb_cli "https://github.com/erenpattern/darwinex/blob/main/xarb/cli.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_pmm_config,node_collector,node_observations,node_reliability,node_arbiter,node_paper_reconcile,node_pmm_ledger,node_capability_audit,node_phase_audit,node_supervisor,node_observability,node_snapshot,node_daily_reports,node_pmm_dashboard,node_dashboard_user toneBlue
class node_quant_pipeline,node_baseline_eval,node_replay,node_walk_forward,node_promotion,node_divergence,node_regime,node_experimental_backtest,node_adaptive_shadow toneAmber
class node_capture_runner,node_feeds,node_xarb_engine,node_xarb_ledger,node_xarb_reconcile,node_xarb_cli,node_coinbase,node_kraken toneMint
class node_hummingbot,node_researcher toneIndigo
```

## Components

### PMM Monitoring

- [Paper configuration](https://github.com/erenpattern/darwinex/blob/main/pmm/hummingbot/conf/strategies/conf_btc_usdt_paper_v1.yml): `pmm/hummingbot/conf/strategies/conf_btc_usdt_paper_v1.yml`
- [Temporal collector](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_temporal_collector.py): `pmm/monitoring/paper_temporal_collector.py`
- [Observation store](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_temporal_collector.py): `pmm/monitoring/paper_temporal_collector.py`
- [Reliability kernel](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/reliability_kernel.py): `pmm/monitoring/reliability_kernel.py`
- [Decision arbiter](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/decision_arbiter.py): `pmm/monitoring/decision_arbiter.py`
- [Paper reconciliation](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_reconcile.py): `pmm/monitoring/paper_reconcile.py`
- [Reconciliation ledger](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_reconcile.py): `pmm/monitoring/paper_reconcile.py`
- [Capability audit](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/capability_audit.py): `pmm/monitoring/capability_audit.py`
- [Phase audit](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/phase_audit.py): `pmm/monitoring/phase_audit.py`
- [Paper supervisor](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_supervisor.py): `pmm/monitoring/paper_supervisor.py`
- [Observability supervisor](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/observability_supervisor.py): `pmm/monitoring/observability_supervisor.py`
- [Paper snapshot](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/paper_snapshot.py): `pmm/monitoring/paper_snapshot.py`
- [Daily reports](https://github.com/erenpattern/darwinex/blob/main/pmm/monitoring/generate_daily_reports.py): `pmm/monitoring/generate_daily_reports.py`
- [Read-only dashboard](https://github.com/erenpattern/darwinex/blob/main/pmm/dashboard/server.py): `pmm/dashboard/server.py`

### PMM Research

- [Quant pipeline](https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/quant_pipeline.py): `pmm/research/src/quant_pipeline.py`
- [Baseline evaluation](https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/baseline_evaluation.py): `pmm/research/src/baseline_evaluation.py`
- [Captured replay](https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/replay_captured.py): `pmm/research/src/replay_captured.py`
- [Walk-forward analysis](https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/walk_forward_captured.py): `pmm/research/src/walk_forward_captured.py`
- [Promotion gate](https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/promotion_gate.py): `pmm/research/src/promotion_gate.py`
- [Divergence analysis](https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/divergence_analysis.py): `pmm/research/src/divergence_analysis.py`
- [Regime analysis](https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/regime_analysis.py): `pmm/research/src/regime_analysis.py`
- [Experimental backtest](https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/experimental_pmm_backtest.py): `pmm/research/src/experimental_pmm_backtest.py`
- [Adaptive shadow run](https://github.com/erenpattern/darwinex/blob/main/pmm/research/src/shadow_adaptive_pmm.py): `pmm/research/src/shadow_adaptive_pmm.py`

### XARB Lab

- [Capture runner](https://github.com/erenpattern/darwinex/blob/main/xarb/run_capture.py): `xarb/run_capture.py`
- [Feed adapters](https://github.com/erenpattern/darwinex/blob/main/xarb/feeds.py): `xarb/feeds.py`
- [Arbitrage engine](https://github.com/erenpattern/darwinex/blob/main/xarb/engine.py): `xarb/engine.py`
- [Append-only ledger](https://github.com/erenpattern/darwinex/blob/main/xarb/engine.py): `xarb/engine.py`
- [Capture reconciliation](https://github.com/erenpattern/darwinex/blob/main/xarb/reconcile.py): `xarb/reconcile.py`
- [Replay CLI](https://github.com/erenpattern/darwinex/blob/main/xarb/cli.py): `xarb/cli.py`

### Other components

- **Hummingbot paper bot**
- **Dashboard viewer**
- **Researcher**
- **Coinbase public API**
- **Kraken public API**

## Connections

- Hummingbot paper bot → Temporal collector: provides observations (evidence: `README.md`)
- Paper configuration → Hummingbot paper bot: configures paper bot (evidence: `README.md`)
- Temporal collector → Observation store: writes observations (evidence: `pmm/monitoring/paper_temporal_collector.py`)
- Temporal collector → Reliability kernel: assesses health (evidence: `pmm/monitoring/paper_temporal_collector.py`)
- Temporal collector → Decision arbiter: initializes decision schema (evidence: `pmm/monitoring/paper_temporal_collector.py`)
- Paper reconciliation → Reconciliation ledger: writes ledger (evidence: `pmm/monitoring/paper_reconcile.py`)
- Paper reconciliation → Decision arbiter: uses decision contract (evidence: `pmm/monitoring/paper_reconcile.py`)
- Paper reconciliation → Reliability kernel: uses health checks (evidence: `pmm/monitoring/paper_reconcile.py`)
- Decision arbiter → Reliability kernel: assesses health (evidence: `pmm/monitoring/decision_arbiter.py`)
- Adaptive shadow run → Reliability kernel: assesses health (evidence: `pmm/research/src/shadow_adaptive_pmm.py`)
- Adaptive shadow run → Decision arbiter: builds decisions (evidence: `pmm/research/src/shadow_adaptive_pmm.py`)
- Walk-forward analysis → Decision arbiter: uses ensemble (evidence: `pmm/research/src/walk_forward_captured.py`)
- Dashboard viewer → Read-only dashboard: views status (evidence: `README.md`)
- Researcher → Quant pipeline: runs research (evidence: `README.md`)
- Coinbase public API → Feed adapters: supplies order book (evidence: `xarb/feeds.py`)
- Kraken public API → Feed adapters: supplies order book (evidence: `xarb/feeds.py`)
- Capture runner → Feed adapters: captures feeds (evidence: `xarb/run_capture.py`)
- Capture runner → Capture reconciliation: runs reconciliation (evidence: `xarb/run_capture.py`)
- Feed adapters → Arbitrage engine: validates opportunity (evidence: `xarb/feeds.py`)
- Arbitrage engine → Append-only ledger: appends events (evidence: `xarb/engine.py`)
- Replay CLI → Arbitrage engine: replays quotes (evidence: `xarb/cli.py`)
