# abides-sim/abides architecture

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

- Interactive diagram: https://gitdiagram.com/abides-sim/abides
- Repository: https://github.com/abides-sim/abides

## Overview

ABIDES is a configurable, message-driven agent-based market simulator for AI and market research. A researcher selects a scenario, which configures the Kernel, exchange, oracle, and participant population; the Kernel advances simulated time and routes interactions, while agents request market information and submit orders to the exchange. The exchange maintains order books and facilitates trades. Simulation output can then support realism and market-impact analysis. The README documents configurable pairwise latencies and large agent populations; sampled source confirms configuration and trading-agent messaging, but not every runtime call path.

Main entry points: [`Kernel.py`](https://github.com/abides-sim/abides/blob/master/Kernel.py) (Simulation Kernel), [`agent/TradingAgent.py`](https://github.com/abides-sim/abides/blob/master/agent/TradingAgent.py) (Trading agent base), [`agent/ExchangeAgent.py`](https://github.com/abides-sim/abides/blob/master/agent/ExchangeAgent.py) (Exchange agent), [`config`](https://github.com/abides-sim/abides/tree/master/config) (Scenario config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Simulation runtime"]
  node_scenario["Scenario config"]
  node_kernel["Simulation Kernel<br/>[Kernel.py]"]
  node_latency["Latency model<br/>[LatencyModel.py]"]
  node_message["Message protocol<br/>[Message.py]"]
end

subgraph group_participants["Market participants"]
  node_trading["Trading agent base<br/>[TradingAgent.py]"]
  node_strategies["Trading strategies"]
  node_execution["Execution agents"]
  node_marketmakers["Market makers"]
  node_etf["ETF participants"]
end

subgraph group_market["Market data and orders"]
  node_oracle["Fundamental oracle"]
  node_exchange["Exchange agent<br/>[ExchangeAgent.py]"]
  node_orderbook[("Order book<br/>[OrderBook.py]")]
  node_orders["Order types"]
end

subgraph group_research["Research outputs"]
  node_logs["Simulation logs"]
  node_realism["Realism analysis"]
  node_cli["Log and book tools"]
end

node_researcher(("Researcher"))

node_researcher -->|"selects scenario"| node_scenario
node_scenario -->|"configures run"| node_kernel
node_scenario -->|"selects oracle"| node_oracle
node_kernel -->|"uses delays"| node_latency
node_kernel -->|"routes messages"| node_message
node_kernel -->|"runs agent"| node_exchange
node_kernel -->|"runs agents"| node_trading
node_kernel -->|"runs agents"| node_strategies
node_kernel -->|"runs agents"| node_execution
node_kernel -->|"runs agents"| node_marketmakers
node_kernel -->|"runs agents"| node_etf
node_trading -->|"sends orders"| node_exchange
node_trading -->|"requests data"| node_exchange
node_strategies -->|"extends base"| node_trading
node_execution -->|"extends base"| node_trading
node_marketmakers -->|"extends base"| node_trading
node_etf -->|"uses trading API"| node_trading
node_exchange -->|"updates book"| node_orderbook
node_exchange -->|"processes orders"| node_orders
node_exchange -->|"sends market data"| node_trading
node_kernel -->|"writes run data"| node_logs
node_logs -->|"analyzes output"| node_realism
node_logs -->|"reads logs"| node_cli

click node_scenario "https://github.com/abides-sim/abides/tree/master/config"
click node_kernel "https://github.com/abides-sim/abides/blob/master/Kernel.py"
click node_latency "https://github.com/abides-sim/abides/blob/master/model/LatencyModel.py"
click node_message "https://github.com/abides-sim/abides/blob/master/message/Message.py"
click node_oracle "https://github.com/abides-sim/abides/tree/master/util/oracle"
click node_exchange "https://github.com/abides-sim/abides/blob/master/agent/ExchangeAgent.py"
click node_orderbook "https://github.com/abides-sim/abides/blob/master/util/OrderBook.py"
click node_orders "https://github.com/abides-sim/abides/tree/master/util/order"
click node_trading "https://github.com/abides-sim/abides/blob/master/agent/TradingAgent.py"
click node_strategies "https://github.com/abides-sim/abides/tree/master/agent"
click node_execution "https://github.com/abides-sim/abides/tree/master/agent/execution"
click node_marketmakers "https://github.com/abides-sim/abides/tree/master/agent/market_makers"
click node_etf "https://github.com/abides-sim/abides/tree/master/agent/etf"
click node_logs "https://github.com/abides-sim/abides/blob/master/util/simulation_run_stats.py"
click node_realism "https://github.com/abides-sim/abides/tree/master/realism"
click node_cli "https://github.com/abides-sim/abides/tree/master/cli"

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_scenario,node_kernel,node_latency,node_message toneBlue
class node_trading,node_strategies,node_execution,node_marketmakers,node_etf toneAmber
class node_oracle,node_exchange,node_orderbook,node_orders toneMint
class node_logs,node_realism,node_cli toneRose
class node_researcher toneIndigo
```

## Components

### Simulation runtime

- [Scenario config](https://github.com/abides-sim/abides/tree/master/config): `config`
- [Simulation Kernel](https://github.com/abides-sim/abides/blob/master/Kernel.py): `Kernel.py`
- [Latency model](https://github.com/abides-sim/abides/blob/master/model/LatencyModel.py): `model/LatencyModel.py`
- [Message protocol](https://github.com/abides-sim/abides/blob/master/message/Message.py): `message/Message.py`

### Market participants

- [Trading agent base](https://github.com/abides-sim/abides/blob/master/agent/TradingAgent.py): `agent/TradingAgent.py`
- [Trading strategies](https://github.com/abides-sim/abides/tree/master/agent): `agent`
- [Execution agents](https://github.com/abides-sim/abides/tree/master/agent/execution): `agent/execution`
- [Market makers](https://github.com/abides-sim/abides/tree/master/agent/market_makers): `agent/market_makers`
- [ETF participants](https://github.com/abides-sim/abides/tree/master/agent/etf): `agent/etf`

### Market data and orders

- [Fundamental oracle](https://github.com/abides-sim/abides/tree/master/util/oracle): `util/oracle`
- [Exchange agent](https://github.com/abides-sim/abides/blob/master/agent/ExchangeAgent.py): `agent/ExchangeAgent.py`
- [Order book](https://github.com/abides-sim/abides/blob/master/util/OrderBook.py): `util/OrderBook.py`
- [Order types](https://github.com/abides-sim/abides/tree/master/util/order): `util/order`

### Research outputs

- [Simulation logs](https://github.com/abides-sim/abides/blob/master/util/simulation_run_stats.py): `util/simulation_run_stats.py`
- [Realism analysis](https://github.com/abides-sim/abides/tree/master/realism): `realism`
- [Log and book tools](https://github.com/abides-sim/abides/tree/master/cli): `cli`

### Other components

- **Researcher**

## Connections

- Researcher → Scenario config: selects scenario
- Scenario config → Simulation Kernel: configures run
- Scenario config → Fundamental oracle: selects oracle
- Simulation Kernel → Latency model: uses delays
- Simulation Kernel → Message protocol: routes messages
- Simulation Kernel → Exchange agent: runs agent
- Simulation Kernel → Trading agent base: runs agents
- Simulation Kernel → Trading strategies: runs agents
- Simulation Kernel → Execution agents: runs agents
- Simulation Kernel → Market makers: runs agents
- Simulation Kernel → ETF participants: runs agents
- Trading agent base → Exchange agent: sends orders
- Trading agent base → Exchange agent: requests data
- Trading strategies → Trading agent base: extends base
- Execution agents → Trading agent base: extends base
- Market makers → Trading agent base: extends base
- ETF participants → Trading agent base: uses trading API
- Exchange agent → Order book: updates book
- Exchange agent → Order types: processes orders
- Exchange agent → Trading agent base: sends market data
- Simulation Kernel → Simulation logs: writes run data
- Simulation logs → Realism analysis: analyzes output
- Simulation logs → Log and book tools: reads logs
