# jesse-ai/jesse architecture

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

- Interactive diagram: https://gitdiagram.com/jesse-ai/jesse
- Repository: https://github.com/jesse-ai/jesse

## Overview

Jesse is a self-hosted crypto strategy framework: users define Python strategies, then run backtests and research, optimize parameters, and deploy in paper/live trading. The main runtime spans API controllers, strategy and simulation modes, exchange/order handling, and session results; candles feed both simulation and live market views. Separate branches provide candle import/export, statistical significance and Monte Carlo analysis, ML, charts, and MCP access. The graph uses README capabilities and the supplied tree; most subsystem wiring beyond sampled controller, service, and repository excerpts is intentionally left unspecified.

Main entry points: [`jesse/controllers`](https://github.com/jesse-ai/jesse/tree/master/jesse/controllers) (HTTP controllers), [`jesse/modes/backtest_mode.py`](https://github.com/jesse-ai/jesse/blob/master/jesse/modes/backtest_mode.py) (Backtest mode), [`jesse/controllers/live_controller.py`](https://github.com/jesse-ai/jesse/blob/master/jesse/controllers/live_controller.py) (Live mode), [`jesse/services/strategy_service.py`](https://github.com/jesse-ai/jesse/blob/master/jesse/services/strategy_service.py) (Strategy runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_controllers["HTTP controllers"]
  node_auth["Authentication<br/>[auth.py]"]
end

subgraph group_trading["Strategy and trading"]
  node_strategy["Strategy runtime"]
  node_routes["Trading routes"]
  node_backtest["Backtest mode<br/>[backtest_mode.py]"]
  node_live["Live mode<br/>[live_controller.py]"]
  node_exchange["Exchange adapters"]
  node_orders["Order handling<br/>[order_service.py]"]
  node_indicators["Technical indicators"]
  node_metrics["Metrics and reports<br/>[metrics.py]"]
  node_charts["Interactive charts<br/>[charts.py]"]
end

subgraph group_research["Research workflows"]
  node_optimization["Parameter optimization"]
  node_montecarlo["Monte Carlo"]
  node_significance["Rule significance"]
  node_ml["Machine learning<br/>[ml.py]"]
end

subgraph group_data["Market data and state"]
  node_candles["Candle service<br/>[candle_service.py]"]
  node_candle_import["Candle import/export"]
  node_candle_store[("Candle repository")]
  node_sessions[("Session records<br/>[BacktestSession.py]")]
  node_orders_store[("Order records")]
end

subgraph group_extensions["User integrations"]
  node_mcp_server["MCP server and tools<br/>[server.py]"]
  node_notifications["Notifications<br/>[notifier.py]"]
  node_websocket["WebSocket updates<br/>[ws_manager.py]"]
  node_redis[("Redis pub/sub<br/>[redis.py]")]
  node_research_api["Research API"]
end

node_user(("Trader / researcher"))
node_mcp_client(("MCP assistant"))

node_user -->|"submits requests"| node_controllers
node_controllers -->|"checks access"| node_auth
node_controllers -->|"starts backtests"| node_backtest
node_controllers -->|"starts live sessions"| node_live
node_controllers -->|"starts optimization"| node_optimization
node_controllers -->|"starts simulations"| node_montecarlo
node_controllers -->|"requests tests"| node_significance
node_controllers -->|"manages candles"| node_candle_import
node_backtest -->|"runs strategy"| node_strategy
node_live -->|"runs strategy"| node_strategy
node_strategy -->|"evaluates routes"| node_routes
node_strategy -->|"uses indicators"| node_indicators
node_backtest -->|"reads candles"| node_candles
node_live -->|"reads candles"| node_candles
node_candles -->|"loads candles"| node_candle_store
node_candle_import -->|"imports and exports"| node_candle_store
node_strategy -->|"creates orders"| node_orders
node_orders -->|"submits orders"| node_exchange
node_orders -->|"persists orders"| node_orders_store
node_backtest -->|"records sessions"| node_sessions
node_optimization -->|"evaluates strategies"| node_backtest
node_optimization -->|"records results"| node_sessions
node_montecarlo -->|"records results"| node_sessions
node_significance -->|"uses history"| node_candles
node_backtest -->|"produces metrics"| node_metrics
node_backtest -->|"produces charts"| node_charts
node_live -->|"provides chart data"| node_charts
node_mcp_client -->|"invokes tools"| node_mcp_server
node_mcp_server -->|"calls Jesse API"| node_controllers
node_research_api -->|"runs backtests"| node_backtest
node_research_api -->|"runs optimization"| node_optimization
node_research_api -->|"runs tests"| node_significance
node_research_api -->|"runs simulations"| node_montecarlo
node_ml -->|"uses backtest data"| node_backtest
node_live -.->|"sends alerts"| node_notifications
node_websocket -->|"subscribes events"| node_redis

click node_controllers "https://github.com/jesse-ai/jesse/tree/master/jesse/controllers"
click node_auth "https://github.com/jesse-ai/jesse/blob/master/jesse/services/auth.py"
click node_strategy "https://github.com/jesse-ai/jesse/blob/master/jesse/services/strategy_service.py"
click node_routes "https://github.com/jesse-ai/jesse/tree/master/jesse/routes"
click node_backtest "https://github.com/jesse-ai/jesse/blob/master/jesse/modes/backtest_mode.py"
click node_live "https://github.com/jesse-ai/jesse/blob/master/jesse/controllers/live_controller.py"
click node_exchange "https://github.com/jesse-ai/jesse/tree/master/jesse/exchanges"
click node_orders "https://github.com/jesse-ai/jesse/blob/master/jesse/services/order_service.py"
click node_indicators "https://github.com/jesse-ai/jesse/tree/master/jesse/indicators"
click node_candles "https://github.com/jesse-ai/jesse/blob/master/jesse/services/candle_service.py"
click node_candle_import "https://github.com/jesse-ai/jesse/blob/master/jesse/controllers/candles_controller.py"
click node_candle_store "https://github.com/jesse-ai/jesse/blob/master/jesse/repositories/candle_repository.py"
click node_sessions "https://github.com/jesse-ai/jesse/blob/master/jesse/models/BacktestSession.py"
click node_orders_store "https://github.com/jesse-ai/jesse/blob/master/jesse/repositories/order_repository.py"
click node_metrics "https://github.com/jesse-ai/jesse/blob/master/jesse/services/metrics.py"
click node_charts "https://github.com/jesse-ai/jesse/blob/master/jesse/services/charts.py"
click node_optimization "https://github.com/jesse-ai/jesse/tree/master/jesse/modes/optimize_mode"
click node_montecarlo "https://github.com/jesse-ai/jesse/tree/master/jesse/modes/monte_carlo_mode"
click node_significance "https://github.com/jesse-ai/jesse/tree/master/jesse/research/rule_significance_testing"
click node_ml "https://github.com/jesse-ai/jesse/blob/master/jesse/research/ml.py"
click node_mcp_server "https://github.com/jesse-ai/jesse/blob/master/jesse/mcp/server.py"
click node_notifications "https://github.com/jesse-ai/jesse/blob/master/jesse/services/notifier.py"
click node_websocket "https://github.com/jesse-ai/jesse/blob/master/jesse/services/ws_manager.py"
click node_redis "https://github.com/jesse-ai/jesse/blob/master/jesse/services/redis.py"
click node_research_api "https://github.com/jesse-ai/jesse/tree/master/jesse/research"

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_controllers,node_auth toneBlue
class node_strategy,node_routes,node_backtest,node_live,node_exchange,node_orders,node_indicators,node_metrics,node_charts toneAmber
class node_optimization,node_montecarlo,node_significance,node_ml toneMint
class node_candles,node_candle_import,node_candle_store,node_sessions,node_orders_store toneRose
class node_mcp_server,node_notifications,node_websocket,node_redis,node_research_api,node_user,node_mcp_client toneIndigo
```

## Components

### API and access

- [HTTP controllers](https://github.com/jesse-ai/jesse/tree/master/jesse/controllers): `jesse/controllers`
- [Authentication](https://github.com/jesse-ai/jesse/blob/master/jesse/services/auth.py): `jesse/services/auth.py`

### Strategy and trading

- [Strategy runtime](https://github.com/jesse-ai/jesse/blob/master/jesse/services/strategy_service.py): `jesse/services/strategy_service.py`
- [Trading routes](https://github.com/jesse-ai/jesse/tree/master/jesse/routes): `jesse/routes`
- [Backtest mode](https://github.com/jesse-ai/jesse/blob/master/jesse/modes/backtest_mode.py): `jesse/modes/backtest_mode.py`
- [Live mode](https://github.com/jesse-ai/jesse/blob/master/jesse/controllers/live_controller.py): `jesse/controllers/live_controller.py`
- [Exchange adapters](https://github.com/jesse-ai/jesse/tree/master/jesse/exchanges): `jesse/exchanges`
- [Order handling](https://github.com/jesse-ai/jesse/blob/master/jesse/services/order_service.py): `jesse/services/order_service.py`
- [Technical indicators](https://github.com/jesse-ai/jesse/tree/master/jesse/indicators): `jesse/indicators`
- [Metrics and reports](https://github.com/jesse-ai/jesse/blob/master/jesse/services/metrics.py): `jesse/services/metrics.py`
- [Interactive charts](https://github.com/jesse-ai/jesse/blob/master/jesse/services/charts.py): `jesse/services/charts.py`

### Research workflows

- [Parameter optimization](https://github.com/jesse-ai/jesse/tree/master/jesse/modes/optimize_mode): `jesse/modes/optimize_mode`
- [Monte Carlo](https://github.com/jesse-ai/jesse/tree/master/jesse/modes/monte_carlo_mode): `jesse/modes/monte_carlo_mode`
- [Rule significance](https://github.com/jesse-ai/jesse/tree/master/jesse/research/rule_significance_testing): `jesse/research/rule_significance_testing`
- [Machine learning](https://github.com/jesse-ai/jesse/blob/master/jesse/research/ml.py): `jesse/research/ml.py`

### Market data and state

- [Candle service](https://github.com/jesse-ai/jesse/blob/master/jesse/services/candle_service.py): `jesse/services/candle_service.py`
- [Candle import/export](https://github.com/jesse-ai/jesse/blob/master/jesse/controllers/candles_controller.py): `jesse/controllers/candles_controller.py`
- [Candle repository](https://github.com/jesse-ai/jesse/blob/master/jesse/repositories/candle_repository.py): `jesse/repositories/candle_repository.py`
- [Session records](https://github.com/jesse-ai/jesse/blob/master/jesse/models/BacktestSession.py): `jesse/models/BacktestSession.py`
- [Order records](https://github.com/jesse-ai/jesse/blob/master/jesse/repositories/order_repository.py): `jesse/repositories/order_repository.py`

### User integrations

- [MCP server and tools](https://github.com/jesse-ai/jesse/blob/master/jesse/mcp/server.py): `jesse/mcp/server.py`
- [Notifications](https://github.com/jesse-ai/jesse/blob/master/jesse/services/notifier.py): `jesse/services/notifier.py`
- [WebSocket updates](https://github.com/jesse-ai/jesse/blob/master/jesse/services/ws_manager.py): `jesse/services/ws_manager.py`
- [Redis pub/sub](https://github.com/jesse-ai/jesse/blob/master/jesse/services/redis.py): `jesse/services/redis.py`
- [Research API](https://github.com/jesse-ai/jesse/tree/master/jesse/research): `jesse/research`

### Other components

- **Trader / researcher**
- **MCP assistant**

## Connections

- Trader / researcher → HTTP controllers: submits requests
- HTTP controllers → Authentication: checks access
- HTTP controllers → Backtest mode: starts backtests
- HTTP controllers → Live mode: starts live sessions
- HTTP controllers → Parameter optimization: starts optimization
- HTTP controllers → Monte Carlo: starts simulations
- HTTP controllers → Rule significance: requests tests
- HTTP controllers → Candle import/export: manages candles
- Backtest mode → Strategy runtime: runs strategy
- Live mode → Strategy runtime: runs strategy
- Strategy runtime → Trading routes: evaluates routes
- Strategy runtime → Technical indicators: uses indicators
- Backtest mode → Candle service: reads candles
- Live mode → Candle service: reads candles
- Candle service → Candle repository: loads candles
- Candle import/export → Candle repository: imports and exports
- Strategy runtime → Order handling: creates orders
- Order handling → Exchange adapters: submits orders
- Order handling → Order records: persists orders
- Backtest mode → Session records: records sessions
- Parameter optimization → Backtest mode: evaluates strategies
- Parameter optimization → Session records: records results
- Monte Carlo → Session records: records results
- Rule significance → Candle service: uses history
- Backtest mode → Metrics and reports: produces metrics
- Backtest mode → Interactive charts: produces charts
- Live mode → Interactive charts: provides chart data
- MCP assistant → MCP server and tools: invokes tools
- MCP server and tools → HTTP controllers: calls Jesse API
- Research API → Backtest mode: runs backtests
- Research API → Parameter optimization: runs optimization
- Research API → Rule significance: runs tests
- Research API → Monte Carlo: runs simulations
- Machine learning → Backtest mode: uses backtest data
- Live mode → Notifications: sends alerts
- WebSocket updates → Redis pub/sub: subscribes events
