# banbox/banbot architecture

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

## Overview

banbot is an event-driven, multi-symbol and multi-account trading platform with strategy research, historical simulation, live execution, and a web UI. The user-facing path starts with configuring or authoring a strategy, then running backtests or deploying trading; data, runtime coordination, and execution support both modes. The README also describes factor research, hyperparameter optimization, and exchange support. Relationships are limited to README statements and the supplied source-index references; several subsystem implementations were not sampled, so the graph does not infer their internal call paths.

Main entry points: [`entry/main.go`](https://github.com/banbox/banbot/blob/main/entry/main.go) (CLI commands), [`runtime/runtime.go`](https://github.com/banbox/banbot/blob/main/runtime/runtime.go) (Runtime coordinator), [`factor/runner/storage_input.go`](https://github.com/banbox/banbot/blob/main/factor/runner/storage_input.go) (Historical inputs), [`opt/backtest.go`](https://github.com/banbox/banbot/blob/main/opt/backtest.go) (Backtesting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["Product entry"]
  node_cli["CLI commands<br/>[main.go]"]
  node_config["Run configuration<br/>[run_spec.go]"]
end

subgraph group_data["Market data"]
  node_data_catalog["Source catalog<br/>[source_catalog.go]"]
  node_data_provider["Market data<br/>[provider.go]"]
end

subgraph group_strategy["Strategy and research"]
  node_time_strategy["Time-series engine<br/>[main.go]"]
  node_factor_engine["Factor engine<br/>[runner.go]"]
  node_factor_inputs["Historical inputs<br/>[storage_input.go]"]
  node_factor_research["Factor research<br/>[experiment.go]"]
  node_optimizer["Hyper optimization<br/>[hyper_opt.go]"]
  node_backtest["Backtesting<br/>[backtest.go]"]
end

subgraph group_runtime["Runtime and execution"]
  node_runtime["Runtime coordinator<br/>[runtime.go]"]
  node_execution["Order execution<br/>[coordinator.go]"]
  node_exchange["Exchange adapter<br/>[banexg_adapter.go]"]
  node_ledger[("Execution state<br/>[ledger.go]")]
end

subgraph group_interfaces["Interfaces and storage"]
  node_webui["Web UI<br/>[+page.svelte]"]
  node_webserver["Web server<br/>[main.go]"]
  node_series_store[("Series storage<br/>[series_store.go]")]
  node_reports["Backtest reports<br/>[reports.go]"]
  node_notifications["Notifications<br/>[webhook.go]"]
end

node_user(("Trader"))
node_external_exchange(("Exchange venue"))

node_user -->|"configures or runs"| node_cli
node_user -->|"authors and deploys"| node_webui
node_cli -->|"starts commands"| node_runtime
node_cli -->|"starts web"| node_webserver
node_webserver -->|"serves UI"| node_webui
node_cli -.->|"loads configuration"| node_config
node_runtime -->|"uses market data"| node_data_provider
node_runtime -->|"uses strategies"| node_time_strategy
node_runtime -->|"uses execution"| node_execution
node_runtime -->|"uses persistence"| node_series_store
node_factor_inputs -->|"reads pages"| node_series_store
node_factor_engine -.->|"consumes inputs"| node_factor_inputs
node_cli -->|"runs backtests"| node_backtest
node_cli -->|"runs research"| node_factor_research
node_cli -->|"runs optimization"| node_optimizer
node_backtest -.->|"produces reports"| node_reports
node_execution -.->|"dispatches orders"| node_exchange
node_exchange -.->|"sends orders"| node_external_exchange
node_runtime -->|"uses notifications"| node_notifications

click node_cli "https://github.com/banbox/banbot/blob/main/entry/main.go"
click node_webui "https://github.com/banbox/banbot/blob/main/web/ui/src/routes/(dev)/%2Bpage.svelte"
click node_webserver "https://github.com/banbox/banbot/blob/main/web/dev/main.go"
click node_config "https://github.com/banbox/banbot/blob/main/config/run_spec.go"
click node_data_catalog "https://github.com/banbox/banbot/blob/main/data/source_catalog.go"
click node_data_provider "https://github.com/banbox/banbot/blob/main/data/provider.go"
click node_series_store "https://github.com/banbox/banbot/blob/main/orm/series_store.go"
click node_time_strategy "https://github.com/banbox/banbot/blob/main/strat/main.go"
click node_factor_engine "https://github.com/banbox/banbot/blob/main/factor/runner/runner.go"
click node_factor_inputs "https://github.com/banbox/banbot/blob/main/factor/runner/storage_input.go"
click node_factor_research "https://github.com/banbox/banbot/blob/main/factor/research/experiment.go"
click node_optimizer "https://github.com/banbox/banbot/blob/main/opt/hyper_opt.go"
click node_backtest "https://github.com/banbox/banbot/blob/main/opt/backtest.go"
click node_runtime "https://github.com/banbox/banbot/blob/main/runtime/runtime.go"
click node_execution "https://github.com/banbox/banbot/blob/main/execution/coordinator.go"
click node_exchange "https://github.com/banbox/banbot/blob/main/execution/banexg_adapter.go"
click node_ledger "https://github.com/banbox/banbot/blob/main/execution/ledger.go"
click node_reports "https://github.com/banbox/banbot/blob/main/opt/reports.go"
click node_notifications "https://github.com/banbox/banbot/blob/main/rpc/webhook.go"

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 toneBlue
class node_data_catalog,node_data_provider toneAmber
class node_time_strategy,node_factor_engine,node_factor_inputs,node_factor_research,node_optimizer,node_backtest toneMint
class node_runtime,node_execution,node_exchange,node_ledger toneRose
class node_webui,node_webserver,node_series_store,node_reports,node_notifications,node_user,node_external_exchange toneIndigo
```

## Components

### Product entry

- [CLI commands](https://github.com/banbox/banbot/blob/main/entry/main.go): `entry/main.go`
- [Run configuration](https://github.com/banbox/banbot/blob/main/config/run_spec.go): `config/run_spec.go`

### Market data

- [Source catalog](https://github.com/banbox/banbot/blob/main/data/source_catalog.go): `data/source_catalog.go`
- [Market data](https://github.com/banbox/banbot/blob/main/data/provider.go): `data/provider.go`

### Strategy and research

- [Time-series engine](https://github.com/banbox/banbot/blob/main/strat/main.go): `strat/main.go`
- [Factor engine](https://github.com/banbox/banbot/blob/main/factor/runner/runner.go): `factor/runner/runner.go`
- [Historical inputs](https://github.com/banbox/banbot/blob/main/factor/runner/storage_input.go): `factor/runner/storage_input.go`
- [Factor research](https://github.com/banbox/banbot/blob/main/factor/research/experiment.go): `factor/research/experiment.go`
- [Hyper optimization](https://github.com/banbox/banbot/blob/main/opt/hyper_opt.go): `opt/hyper_opt.go`
- [Backtesting](https://github.com/banbox/banbot/blob/main/opt/backtest.go): `opt/backtest.go`

### Runtime and execution

- [Runtime coordinator](https://github.com/banbox/banbot/blob/main/runtime/runtime.go): `runtime/runtime.go`
- [Order execution](https://github.com/banbox/banbot/blob/main/execution/coordinator.go): `execution/coordinator.go`
- [Exchange adapter](https://github.com/banbox/banbot/blob/main/execution/banexg_adapter.go): `execution/banexg_adapter.go`
- [Execution state](https://github.com/banbox/banbot/blob/main/execution/ledger.go): `execution/ledger.go`

### Interfaces and storage

- [Web UI](https://github.com/banbox/banbot/blob/main/web/ui/src/routes/(dev)/%2Bpage.svelte): `web/ui/src/routes/(dev)/+page.svelte`
- [Web server](https://github.com/banbox/banbot/blob/main/web/dev/main.go): `web/dev/main.go`
- [Series storage](https://github.com/banbox/banbot/blob/main/orm/series_store.go): `orm/series_store.go`
- [Backtest reports](https://github.com/banbox/banbot/blob/main/opt/reports.go): `opt/reports.go`
- [Notifications](https://github.com/banbox/banbot/blob/main/rpc/webhook.go): `rpc/webhook.go`

### Other components

- **Trader**
- **Exchange venue**

## Connections

- Trader → CLI commands: configures or runs
- Trader → Web UI: authors and deploys
- CLI commands → Runtime coordinator: starts commands (evidence: `runtime/runtime.go`)
- CLI commands → Web server: starts web (evidence: `entry/main.go`)
- Web server → Web UI: serves UI (evidence: `web/dev/main.go`)
- CLI commands → Run configuration: loads configuration
- Runtime coordinator → Market data: uses market data (evidence: `runtime/runtime.go`)
- Runtime coordinator → Time-series engine: uses strategies (evidence: `runtime/runtime.go`)
- Runtime coordinator → Order execution: uses execution (evidence: `runtime/runtime.go`)
- Runtime coordinator → Series storage: uses persistence (evidence: `runtime/runtime.go`)
- Historical inputs → Series storage: reads pages
- Factor engine → Historical inputs: consumes inputs
- CLI commands → Backtesting: runs backtests
- CLI commands → Factor research: runs research
- CLI commands → Hyper optimization: runs optimization
- Backtesting → Backtest reports: produces reports
- Order execution → Exchange adapter: dispatches orders
- Exchange adapter → Exchange venue: sends orders
- Runtime coordinator → Notifications: uses notifications (evidence: `runtime/runtime.go`)
