# ishaanman7898/btc_survivor architecture

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

- Interactive diagram: https://gitdiagram.com/ishaanman7898/btc_survivor
- Repository: https://github.com/ishaanman7898/btc_survivor

## Overview

BTC Survivor runs a live, paper-trading population: market events enter through an exchange feed, the engine updates market state and evaluates bots, simulated fills affect bot accounts, and results are persisted for monitoring and analysis. Bot learning and evolutionary replacement are distinct parts of that loop; replay, read-only reports, and the dashboard provide supporting capabilities. The README documents these capabilities; some implementation details and connections are not shown in the excerpts, so uncertain links are omitted.

Main entry points: [`src/btc_survivor/engine.py`](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/engine.py) (Simulation Engine), [`src/btc_survivor/runner.py`](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/runner.py) (Live Runner), [`src/btc_survivor/store.py`](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/store.py) (SQLite Store), [`src/btc_survivor/bot.py`](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/bot.py) (Bot Learning And Decisions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_live["Live Runtime"]
  node_runner["Live Runner<br/>[runner.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_guard["Host Safety Guard<br/>[guard.py]"]
  node_clock["Clock<br/>[clock.py]"]
  node_engine["Simulation Engine<br/>[engine.py]"]
end

subgraph group_market["Market Data"]
  node_feed["Exchange Feed<br/>[coinbase.py]"]
  node_book["Order Book<br/>[book.py]"]
  node_candles["Candles And Health<br/>[candles.py]"]
end

subgraph group_learning["Learning And Decisions"]
  node_features["Feature Builder<br/>[features.py]"]
  node_labels["Forward Labels<br/>[labels.py]"]
  node_standardizer["Feature Standardizer<br/>[standardizer.py]"]
  node_bot["Bot Learning And Decisions<br/>[bot.py]"]
  node_model["Neural Model<br/>[model.py]"]
end

subgraph group_trading["Trading And Evolution"]
  node_account["Paper Account<br/>[account.py]"]
  node_broker["Simulated Broker<br/>[broker.py]"]
  node_population["Population Evolution<br/>[population.py]"]
  node_seeds["Deterministic Seeds<br/>[seeds.py]"]
end

subgraph group_insight["Persistence And Insight"]
  node_store[("SQLite Store<br/>[store.py]")]
  node_recorder["Raw Message Recorder<br/>[recorder.py]"]
  node_replay["Replay Harness<br/>[replay.py]"]
  node_cli["CLI Reports"]
  node_dashboard["Read-Only Dashboard<br/>[dashboard.py]"]
end

node_operator(("Operator"))
node_coinbase["Coinbase Public Feed"]

node_operator -->|"starts run"| node_runner
node_runner -->|"loads settings"| node_config
node_runner -->|"checks host"| node_guard
node_runner -->|"uses time"| node_clock
node_runner -->|"creates feed"| node_feed
node_coinbase -->|"streams market data"| node_feed
node_feed -.->|"delivers events"| node_engine
node_runner -->|"starts and ticks"| node_engine
node_runner -->|"opens store"| node_store
node_runner -->|"records raw messages"| node_recorder
node_engine -->|"updates and reads"| node_book
node_engine -->|"uses candle history"| node_candles
node_engine -->|"builds features"| node_features
node_engine -->|"matures samples"| node_labels
node_engine -->|"uses scaling"| node_standardizer
node_engine -->|"runs population"| node_population
node_population -->|"creates bots"| node_bot
node_population -->|"derives seeds"| node_seeds
node_bot -->|"trains and predicts"| node_model
node_bot -->|"checks account"| node_account
node_engine -->|"schedules and executes"| node_broker
node_broker -->|"walks book"| node_book
node_engine -->|"persists results"| node_store
node_engine -.->|"updates balances"| node_account
node_operator -->|"requests reports"| node_cli
node_cli -.->|"reads results"| node_store
node_operator -->|"opens dashboard"| node_dashboard
node_dashboard -->|"queries read-only"| node_store
node_operator -->|"runs replay"| node_replay
node_replay -->|"replays events"| node_engine
node_replay -->|"uses persistence"| node_store

click node_runner "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/runner.py"
click node_config "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/config.py"
click node_guard "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/guard.py"
click node_clock "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/clock.py"
click node_feed "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/feed/coinbase.py"
click node_book "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/feed/book.py"
click node_candles "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/feed/candles.py"
click node_engine "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/engine.py"
click node_features "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/features.py"
click node_labels "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/labels.py"
click node_standardizer "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/standardizer.py"
click node_bot "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/bot.py"
click node_model "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/model.py"
click node_account "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/account.py"
click node_broker "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/broker.py"
click node_population "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/population.py"
click node_seeds "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/seeds.py"
click node_store "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/store.py"
click node_recorder "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/recorder.py"
click node_replay "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/replay.py"
click node_cli "https://github.com/ishaanman7898/btc_survivor/tree/feat/initial-bot/src/btc_survivor/cli"
click node_dashboard "https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/dashboard.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_runner,node_config,node_guard,node_clock,node_engine toneBlue
class node_feed,node_book,node_candles toneAmber
class node_features,node_labels,node_standardizer,node_bot,node_model toneMint
class node_account,node_broker,node_population,node_seeds toneRose
class node_store,node_recorder,node_replay,node_cli,node_dashboard,node_operator,node_coinbase toneIndigo
```

## Components

### Live Runtime

- [Live Runner](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/runner.py): `src/btc_survivor/runner.py`
- [Configuration](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/config.py): `src/btc_survivor/config.py`
- [Host Safety Guard](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/guard.py): `src/btc_survivor/guard.py`
- [Clock](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/clock.py): `src/btc_survivor/clock.py`
- [Simulation Engine](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/engine.py): `src/btc_survivor/engine.py`

### Market Data

- [Exchange Feed](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/feed/coinbase.py): `src/btc_survivor/feed/coinbase.py`
- [Order Book](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/feed/book.py): `src/btc_survivor/feed/book.py`
- [Candles And Health](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/feed/candles.py): `src/btc_survivor/feed/candles.py`

### Learning And Decisions

- [Feature Builder](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/features.py): `src/btc_survivor/features.py`
- [Forward Labels](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/labels.py): `src/btc_survivor/labels.py`
- [Feature Standardizer](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/standardizer.py): `src/btc_survivor/standardizer.py`
- [Bot Learning And Decisions](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/bot.py): `src/btc_survivor/bot.py`
- [Neural Model](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/model.py): `src/btc_survivor/model.py`

### Trading And Evolution

- [Paper Account](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/account.py): `src/btc_survivor/account.py`
- [Simulated Broker](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/broker.py): `src/btc_survivor/broker.py`
- [Population Evolution](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/population.py): `src/btc_survivor/population.py`
- [Deterministic Seeds](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/seeds.py): `src/btc_survivor/seeds.py`

### Persistence And Insight

- [SQLite Store](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/store.py): `src/btc_survivor/store.py`
- [Raw Message Recorder](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/recorder.py): `src/btc_survivor/recorder.py`
- [Replay Harness](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/replay.py): `src/btc_survivor/replay.py`
- [CLI Reports](https://github.com/ishaanman7898/btc_survivor/tree/feat/initial-bot/src/btc_survivor/cli): `src/btc_survivor/cli`
- [Read-Only Dashboard](https://github.com/ishaanman7898/btc_survivor/blob/feat/initial-bot/src/btc_survivor/dashboard.py): `src/btc_survivor/dashboard.py`

### Other components

- **Operator**
- **Coinbase Public Feed**

## Connections

- Operator → Live Runner: starts run (evidence: `README.md`)
- Live Runner → Configuration: loads settings (evidence: `src/btc_survivor/runner.py`)
- Live Runner → Host Safety Guard: checks host (evidence: `src/btc_survivor/runner.py`)
- Live Runner → Clock: uses time (evidence: `src/btc_survivor/runner.py`)
- Live Runner → Exchange Feed: creates feed (evidence: `src/btc_survivor/runner.py`)
- Coinbase Public Feed → Exchange Feed: streams market data (evidence: `README.md`)
- Exchange Feed → Simulation Engine: delivers events
- Live Runner → Simulation Engine: starts and ticks (evidence: `src/btc_survivor/runner.py`)
- Live Runner → SQLite Store: opens store (evidence: `src/btc_survivor/runner.py`)
- Live Runner → Raw Message Recorder: records raw messages (evidence: `src/btc_survivor/runner.py`)
- Simulation Engine → Order Book: updates and reads (evidence: `src/btc_survivor/engine.py`)
- Simulation Engine → Candles And Health: uses candle history (evidence: `src/btc_survivor/engine.py`)
- Simulation Engine → Feature Builder: builds features (evidence: `src/btc_survivor/engine.py`)
- Simulation Engine → Forward Labels: matures samples (evidence: `src/btc_survivor/engine.py`)
- Simulation Engine → Feature Standardizer: uses scaling (evidence: `src/btc_survivor/engine.py`)
- Simulation Engine → Population Evolution: runs population (evidence: `src/btc_survivor/engine.py`)
- Population Evolution → Bot Learning And Decisions: creates bots (evidence: `src/btc_survivor/population.py`)
- Population Evolution → Deterministic Seeds: derives seeds (evidence: `src/btc_survivor/population.py`)
- Bot Learning And Decisions → Neural Model: trains and predicts (evidence: `src/btc_survivor/bot.py`)
- Bot Learning And Decisions → Paper Account: checks account (evidence: `src/btc_survivor/bot.py`)
- Simulation Engine → Simulated Broker: schedules and executes (evidence: `src/btc_survivor/engine.py`)
- Simulated Broker → Order Book: walks book (evidence: `src/btc_survivor/broker.py`)
- Simulation Engine → SQLite Store: persists results (evidence: `src/btc_survivor/engine.py`)
- Simulation Engine → Paper Account: updates balances (evidence: `src/btc_survivor/engine.py`)
- Operator → CLI Reports: requests reports (evidence: `README.md`)
- CLI Reports → SQLite Store: reads results
- Operator → Read-Only Dashboard: opens dashboard (evidence: `README.md`)
- Read-Only Dashboard → SQLite Store: queries read-only (evidence: `src/btc_survivor/dashboard.py`)
- Operator → Replay Harness: runs replay (evidence: `README.md`)
- Replay Harness → Simulation Engine: replays events (evidence: `src/btc_survivor/replay.py`)
- Replay Harness → SQLite Store: uses persistence (evidence: `src/btc_survivor/replay.py`)
