# lrvx/lrvx architecture

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

- Interactive diagram: https://gitdiagram.com/lrvx/lrvx
- Repository: https://github.com/lrvx/lrvx

## Overview

lrvx is a cross-language framework for building trading systems. A user authors a strategy, then runs it in backtest, paper, or live mode; market data, indicators, execution, risk, and venue connectors support that work. Replay/data I/O and analytics provide research capabilities, while Python, Node.js, embedded JavaScript, Codon, and C API bindings expose the common toolkit. The MCP server lets AI agents discover and operate parts of the surface. The graph follows README-documented capabilities and sampled references; several subsystem internals were not sampled, so their detailed call paths are omitted.

Main entry points: [`include/lrvx/strategy/strategy.h`](https://github.com/lrvx/lrvx/blob/main/include/lrvx/strategy/strategy.h) (Strategy API), [`include/lrvx/execution/order_router.h`](https://github.com/lrvx/lrvx/blob/main/include/lrvx/execution/order_router.h) (Order Execution), [`src/backtest/backtest_runner.cpp`](https://github.com/lrvx/lrvx/blob/main/src/backtest/backtest_runner.cpp) (Backtesting), [`connectors/src`](https://github.com/lrvx/lrvx/tree/main/connectors/src) (Exchange Connectors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Trading Core"]
  node_strategy["Strategy API<br/>[strategy.h]"]
  node_marketdata["Market Data"]
  node_aggregation["Bar Aggregation<br/>[bar_aggregator.h]"]
  node_indicators["Indicators"]
  node_execution["Order Execution<br/>[order_router.h]"]
  node_risk["Portfolio Risk<br/>[portfolio_risk.cpp]"]
  node_positions["Positions<br/>[position_tracker.h]"]
end

subgraph group_research["Research Data"]
  node_backtest["Backtesting"]
  node_paper["Paper Trading<br/>[engine_cli.py]"]
  node_replay["Replay and Tape"]
  node_analytics["Research Analytics"]
end

subgraph group_integration["Integrations"]
  node_connectors["Exchange Connectors"]
  node_bindings["Language Bindings<br/>[lrvx.cpp]"]
  node_capi["Stable C API<br/>[lrvx_capi.cpp]"]
end

subgraph group_agent["AI Control"]
  node_mcp["MCP Control Plane<br/>[server.py]"]
  node_tools["MCP Tools"]
end

subgraph group_venue["Venue Product"]
  node_venue["Matching Venue<br/>[matching_engine.h]"]
  node_session["Venue Sessions<br/>[session.h]"]
end

node_user(("Strategy User"))
node_mcpagent(("AI Coding Agent"))

node_user -->|"authors"| node_strategy
node_marketdata -.->|"feeds"| node_aggregation
node_aggregation -.->|"provides bars"| node_indicators
node_strategy -->|"runs in"| node_backtest
node_strategy -->|"runs in"| node_paper
node_strategy -.->|"drives"| node_execution
node_strategy -->|"uses"| node_indicators
node_backtest -.->|"optimizes"| node_analytics
node_replay -.->|"supplies data"| node_backtest
node_connectors -->|"implements feeds"| node_marketdata
node_connectors -.->|"implements orders"| node_execution
node_execution -.->|"updates"| node_positions
node_positions -.->|"informs"| node_risk
node_strategy -->|"exposed through"| node_bindings
node_bindings -.->|"integrates via"| node_capi
node_mcpagent -->|"requests tools"| node_mcp
node_mcp -->|"dispatches"| node_tools
node_tools -->|"supports authoring"| node_strategy
node_user -->|"operates venue"| node_venue
node_venue -.->|"sequences sessions"| node_session

click node_strategy "https://github.com/lrvx/lrvx/blob/main/include/lrvx/strategy/strategy.h"
click node_marketdata "https://github.com/lrvx/lrvx/blob/main/include/lrvx/connector/abstract_exchange_connector.h"
click node_aggregation "https://github.com/lrvx/lrvx/blob/main/include/lrvx/aggregator/bar_aggregator.h"
click node_indicators "https://github.com/lrvx/lrvx/blob/main/include/lrvx/indicator/indicator_pipeline.h"
click node_execution "https://github.com/lrvx/lrvx/blob/main/include/lrvx/execution/order_router.h"
click node_risk "https://github.com/lrvx/lrvx/blob/main/src/risk/portfolio_risk.cpp"
click node_positions "https://github.com/lrvx/lrvx/blob/main/include/lrvx/position/position_tracker.h"
click node_backtest "https://github.com/lrvx/lrvx/blob/main/src/backtest/backtest_runner.cpp"
click node_paper "https://github.com/lrvx/lrvx/blob/main/python/lrvx/engine_cli.py"
click node_replay "https://github.com/lrvx/lrvx/blob/main/src/replay/binary_log_reader.cpp"
click node_analytics "https://github.com/lrvx/lrvx/blob/main/include/lrvx/backtest/backtest_optimizer.h"
click node_connectors "https://github.com/lrvx/lrvx/tree/main/connectors/src"
click node_bindings "https://github.com/lrvx/lrvx/blob/main/python/lrvx.cpp"
click node_capi "https://github.com/lrvx/lrvx/blob/main/src/capi/lrvx_capi.cpp"
click node_mcp "https://github.com/lrvx/lrvx/blob/main/mcp/lrvx_mcp/server.py"
click node_tools "https://github.com/lrvx/lrvx/tree/main/mcp/lrvx_mcp/tools"
click node_venue "https://github.com/lrvx/lrvx/blob/main/venue/include/lrvx-venue/matching_engine.h"
click node_session "https://github.com/lrvx/lrvx/blob/main/venue/include/lrvx-venue/engine/session.h"

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_strategy,node_marketdata,node_aggregation,node_indicators,node_execution,node_risk,node_positions,node_user toneBlue
class node_backtest,node_paper,node_replay,node_analytics toneAmber
class node_connectors,node_bindings,node_capi toneMint
class node_mcp,node_tools toneRose
class node_venue,node_session,node_mcpagent toneIndigo
```

## Components

### Trading Core

- [Strategy API](https://github.com/lrvx/lrvx/blob/main/include/lrvx/strategy/strategy.h): `include/lrvx/strategy/strategy.h`
- [Market Data](https://github.com/lrvx/lrvx/blob/main/include/lrvx/connector/abstract_exchange_connector.h): `include/lrvx/connector/abstract_exchange_connector.h`
- [Bar Aggregation](https://github.com/lrvx/lrvx/blob/main/include/lrvx/aggregator/bar_aggregator.h): `include/lrvx/aggregator/bar_aggregator.h`
- [Indicators](https://github.com/lrvx/lrvx/blob/main/include/lrvx/indicator/indicator_pipeline.h): `include/lrvx/indicator/indicator_pipeline.h`
- [Order Execution](https://github.com/lrvx/lrvx/blob/main/include/lrvx/execution/order_router.h): `include/lrvx/execution/order_router.h`
- [Portfolio Risk](https://github.com/lrvx/lrvx/blob/main/src/risk/portfolio_risk.cpp): `src/risk/portfolio_risk.cpp`
- [Positions](https://github.com/lrvx/lrvx/blob/main/include/lrvx/position/position_tracker.h): `include/lrvx/position/position_tracker.h`

### Research Data

- [Backtesting](https://github.com/lrvx/lrvx/blob/main/src/backtest/backtest_runner.cpp): `src/backtest/backtest_runner.cpp`
- [Paper Trading](https://github.com/lrvx/lrvx/blob/main/python/lrvx/engine_cli.py): `python/lrvx/engine_cli.py`
- [Replay and Tape](https://github.com/lrvx/lrvx/blob/main/src/replay/binary_log_reader.cpp): `src/replay/binary_log_reader.cpp`
- [Research Analytics](https://github.com/lrvx/lrvx/blob/main/include/lrvx/backtest/backtest_optimizer.h): `include/lrvx/backtest/backtest_optimizer.h`

### Integrations

- [Exchange Connectors](https://github.com/lrvx/lrvx/tree/main/connectors/src): `connectors/src`
- [Language Bindings](https://github.com/lrvx/lrvx/blob/main/python/lrvx.cpp): `python/lrvx.cpp`
- [Stable C API](https://github.com/lrvx/lrvx/blob/main/src/capi/lrvx_capi.cpp): `src/capi/lrvx_capi.cpp`

### AI Control

- [MCP Control Plane](https://github.com/lrvx/lrvx/blob/main/mcp/lrvx_mcp/server.py): `mcp/lrvx_mcp/server.py`
- [MCP Tools](https://github.com/lrvx/lrvx/tree/main/mcp/lrvx_mcp/tools): `mcp/lrvx_mcp/tools`

### Venue Product

- [Matching Venue](https://github.com/lrvx/lrvx/blob/main/venue/include/lrvx-venue/matching_engine.h): `venue/include/lrvx-venue/matching_engine.h`
- [Venue Sessions](https://github.com/lrvx/lrvx/blob/main/venue/include/lrvx-venue/engine/session.h): `venue/include/lrvx-venue/engine/session.h`

### Other components

- **Strategy User**
- **AI Coding Agent**

## Connections

- Strategy User → Strategy API: authors (evidence: `README.md`)
- Market Data → Bar Aggregation: feeds
- Bar Aggregation → Indicators: provides bars
- Strategy API → Backtesting: runs in (evidence: `README.md`)
- Strategy API → Paper Trading: runs in (evidence: `README.md`)
- Strategy API → Order Execution: drives
- Strategy API → Indicators: uses (evidence: `README.md`)
- Backtesting → Research Analytics: optimizes
- Replay and Tape → Backtesting: supplies data
- Exchange Connectors → Market Data: implements feeds (evidence: `README.md`)
- Exchange Connectors → Order Execution: implements orders
- Order Execution → Positions: updates
- Positions → Portfolio Risk: informs
- Strategy API → Language Bindings: exposed through (evidence: `README.md`)
- Language Bindings → Stable C API: integrates via
- AI Coding Agent → MCP Control Plane: requests tools (evidence: `README.md`)
- MCP Control Plane → MCP Tools: dispatches (evidence: `mcp/lrvx_mcp/server.py`)
- MCP Tools → Strategy API: supports authoring (evidence: `README.md`)
- Strategy User → Matching Venue: operates venue (evidence: `README.md`)
- Matching Venue → Venue Sessions: sequences sessions (evidence: `venue/include/lrvx-venue/matching_engine.h`)
