# gregyoung14/openmarket architecture

> Architecture diagram of the GitHub repository gregyoung14/openmarket, 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/gregyoung14/openmarket
- Repository: https://github.com/gregyoung14/openmarket

## Overview

OpenMarket is a Rust research platform and frozen, paired Polymarket/Binance corpus—not primarily a trading bot. Its documented workflow collects both venues’ events, synchronizes and records them, produces research datasets and features, then supports signal modeling and backtesting with calibration/evaluation. The graph preserves the live signal and execution services as a separate operational branch. README architecture statements support the high-level data-flow edges; sampled entry points confirm collector, signal-server, recorder-ingest, and backtester responsibilities, but most exporter and training internals were not inspected.

Main entry points: [`crates/exchange-binance/src/main.rs`](https://github.com/gregyoung14/openmarket/blob/main/crates/exchange-binance/src/main.rs) (Binance collector), [`crates/exchange-polymarket/src/main.rs`](https://github.com/gregyoung14/openmarket/blob/main/crates/exchange-polymarket/src/main.rs) (Polymarket collector), [`crates/step3-parquet-export/src/main.rs`](https://github.com/gregyoung14/openmarket/blob/main/crates/step3-parquet-export/src/main.rs) (Parquet export), [`crates/recorder/src/ingest.rs`](https://github.com/gregyoung14/openmarket/blob/main/crates/recorder/src/ingest.rs) (Market recorder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Market collection"]
  node_binance["Binance collector<br/>[main.rs]"]
  node_polycollector["Polymarket collector<br/>[main.rs]"]
end

subgraph group_corpus["Recording and corpus"]
  node_recorder["Market recorder<br/>[ingest.rs]"]
  node_snapshotdb[("Snapshot database<br/>[db.rs]")]
  node_backfill["Unified backfill<br/>[main.rs]"]
end

subgraph group_research["Research pipeline"]
  node_data_prep["Data preparation<br/>[main.rs]"]
  node_parquet["Parquet export<br/>[main.rs]"]
  node_trainer["Outcome trainer<br/>[main.rs]"]
end

subgraph group_live["Live services"]
  node_signal["Signal engine<br/>[main.rs]"]
  node_signals_ws["Signal WebSocket<br/>[handlers.rs]"]
  node_execution["Execution engine<br/>[main.rs]"]
  node_paper["Paper executor<br/>[main.rs]"]
end

subgraph group_evaluation["Evaluation"]
  node_backtester["Backtester<br/>[main.rs]"]
  node_calibration["Calibration<br/>[calibration.rs]"]
end

node_analyst(("Research analyst"))
node_archive[("Published corpus")]
node_binance_ws(("Binance WebSocket"))
node_polymarket_ws(("Polymarket CLOB WebSocket"))

node_binance_ws -->|"streams events"| node_binance
node_polymarket_ws -->|"streams events"| node_polycollector
node_binance -.->|"records ticks"| node_recorder
node_polycollector -.->|"records books"| node_recorder
node_recorder -.->|"writes events"| node_snapshotdb
node_snapshotdb -.->|"fills timeline"| node_backfill
node_backfill -.->|"prepares corpus"| node_data_prep
node_data_prep -.->|"exports features"| node_parquet
node_parquet -.->|"publishes dataset"| node_archive
node_archive -->|"supports research"| node_analyst
node_parquet -.->|"trains baseline"| node_trainer
node_binance -->|"upstream market data"| node_signal
node_polycollector -->|"upstream market data"| node_signal
node_signal -->|"serves signals"| node_signals_ws
node_signals_ws -->|"streams signals"| node_execution
node_execution -.->|"paper trading"| node_paper
node_archive -->|"backtests corpus"| node_backtester
node_backtester -.->|"evaluates calibration"| node_calibration
node_analyst -->|"runs evaluation"| node_backtester

click node_binance "https://github.com/gregyoung14/openmarket/blob/main/crates/exchange-binance/src/main.rs"
click node_polycollector "https://github.com/gregyoung14/openmarket/blob/main/crates/exchange-polymarket/src/main.rs"
click node_recorder "https://github.com/gregyoung14/openmarket/blob/main/crates/recorder/src/ingest.rs"
click node_snapshotdb "https://github.com/gregyoung14/openmarket/blob/main/crates/recorder/src/db.rs"
click node_backfill "https://github.com/gregyoung14/openmarket/blob/main/crates/unified-backfill/src/main.rs"
click node_data_prep "https://github.com/gregyoung14/openmarket/blob/main/crates/data-prep/src/main.rs"
click node_parquet "https://github.com/gregyoung14/openmarket/blob/main/crates/step3-parquet-export/src/main.rs"
click node_trainer "https://github.com/gregyoung14/openmarket/blob/main/crates/binary-outcome-trainer/src/main.rs"
click node_signal "https://github.com/gregyoung14/openmarket/blob/main/crates/signal-engine/src/main.rs"
click node_signals_ws "https://github.com/gregyoung14/openmarket/blob/main/crates/signal-engine/src/handlers.rs"
click node_execution "https://github.com/gregyoung14/openmarket/blob/main/crates/execution-engine/src/main.rs"
click node_paper "https://github.com/gregyoung14/openmarket/blob/main/crates/paper-executor/src/main.rs"
click node_backtester "https://github.com/gregyoung14/openmarket/blob/main/crates/backtester/src/main.rs"
click node_calibration "https://github.com/gregyoung14/openmarket/blob/main/crates/backtester/src/calibration.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_binance,node_polycollector toneBlue
class node_recorder,node_snapshotdb,node_backfill,node_archive toneAmber
class node_data_prep,node_parquet,node_trainer toneMint
class node_signal,node_signals_ws,node_execution,node_paper toneRose
class node_backtester,node_calibration,node_analyst,node_binance_ws,node_polymarket_ws toneIndigo
```

## Components

### Market collection

- [Binance collector](https://github.com/gregyoung14/openmarket/blob/main/crates/exchange-binance/src/main.rs): `crates/exchange-binance/src/main.rs`
- [Polymarket collector](https://github.com/gregyoung14/openmarket/blob/main/crates/exchange-polymarket/src/main.rs): `crates/exchange-polymarket/src/main.rs`

### Recording and corpus

- [Market recorder](https://github.com/gregyoung14/openmarket/blob/main/crates/recorder/src/ingest.rs): `crates/recorder/src/ingest.rs`
- [Snapshot database](https://github.com/gregyoung14/openmarket/blob/main/crates/recorder/src/db.rs): `crates/recorder/src/db.rs`
- [Unified backfill](https://github.com/gregyoung14/openmarket/blob/main/crates/unified-backfill/src/main.rs): `crates/unified-backfill/src/main.rs`

### Research pipeline

- [Data preparation](https://github.com/gregyoung14/openmarket/blob/main/crates/data-prep/src/main.rs): `crates/data-prep/src/main.rs`
- [Parquet export](https://github.com/gregyoung14/openmarket/blob/main/crates/step3-parquet-export/src/main.rs): `crates/step3-parquet-export/src/main.rs`
- [Outcome trainer](https://github.com/gregyoung14/openmarket/blob/main/crates/binary-outcome-trainer/src/main.rs): `crates/binary-outcome-trainer/src/main.rs`

### Live services

- [Signal engine](https://github.com/gregyoung14/openmarket/blob/main/crates/signal-engine/src/main.rs): `crates/signal-engine/src/main.rs`
- [Signal WebSocket](https://github.com/gregyoung14/openmarket/blob/main/crates/signal-engine/src/handlers.rs): `crates/signal-engine/src/handlers.rs`
- [Execution engine](https://github.com/gregyoung14/openmarket/blob/main/crates/execution-engine/src/main.rs): `crates/execution-engine/src/main.rs`
- [Paper executor](https://github.com/gregyoung14/openmarket/blob/main/crates/paper-executor/src/main.rs): `crates/paper-executor/src/main.rs`

### Evaluation

- [Backtester](https://github.com/gregyoung14/openmarket/blob/main/crates/backtester/src/main.rs): `crates/backtester/src/main.rs`
- [Calibration](https://github.com/gregyoung14/openmarket/blob/main/crates/backtester/src/calibration.rs): `crates/backtester/src/calibration.rs`

### Other components

- **Research analyst**
- **Published corpus**
- **Binance WebSocket**
- **Polymarket CLOB WebSocket**

## Connections

- Binance WebSocket → Binance collector: streams events (evidence: `README.md`)
- Polymarket CLOB WebSocket → Polymarket collector: streams events (evidence: `README.md`)
- Binance collector → Market recorder: records ticks
- Polymarket collector → Market recorder: records books
- Market recorder → Snapshot database: writes events (evidence: `crates/recorder/src/ingest.rs`)
- Snapshot database → Unified backfill: fills timeline
- Unified backfill → Data preparation: prepares corpus
- Data preparation → Parquet export: exports features
- Parquet export → Published corpus: publishes dataset
- Published corpus → Research analyst: supports research (evidence: `README.md`)
- Parquet export → Outcome trainer: trains baseline
- Binance collector → Signal engine: upstream market data (evidence: `README.md`)
- Polymarket collector → Signal engine: upstream market data (evidence: `README.md`)
- Signal engine → Signal WebSocket: serves signals (evidence: `crates/signal-engine/src/main.rs`)
- Signal WebSocket → Execution engine: streams signals (evidence: `crates/signal-engine/src/handlers.rs`)
- Execution engine → Paper executor: paper trading
- Published corpus → Backtester: backtests corpus (evidence: `README.md`)
- Backtester → Calibration: evaluates calibration (evidence: `crates/backtester/src/main.rs`)
- Research analyst → Backtester: runs evaluation (evidence: `README.md`)
