# rishavrai563/algorithmic-trading-workbench architecture

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

- Interactive diagram: https://gitdiagram.com/rishavrai563/algorithmic-trading-workbench
- Repository: https://github.com/rishavrai563/algorithmic-trading-workbench

## Overview

This is a visual algorithmic-trading workbench: users build a strategy, configure a historical period and asset, submit a backtest, inspect performance and trades, explore parameter variations, and compare runs. The documented UI pages and the sampled C# services support that overall workflow. The backend’s shown orchestration fetches and caches market data, runs LEAN, and parses results. Exploration and comparison are documented capabilities, but their implementation details and some frontend-to-backend wiring were not sampled; those links are therefore not asserted as verified calls.

Main entry points: [`frontend/src/App.jsx`](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/App.jsx) (App & State), [`backend/Controllers/BacktestController.cs`](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Controllers/BacktestController.cs) (Backtest Controller), [`backend/Services/BacktestService.cs`](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/BacktestService.cs) (Backtest Orchestrator), [`backend/Services/HistoricalDataService.cs`](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/HistoricalDataService.cs) (Historical Data Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Workbench UI"]
  node_app["App &amp; State<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_builder["Strategy Builder"]
  node_parameters["Parameters<br/>[Parameters.jsx]"]
  node_loading["Run Progress"]
end

subgraph group_api["Backtest API"]
  node_api_client["Backtest Client<br/>[backtest.js]"]
  node_controller["Backtest Controller"]
  node_jobs["Job Manager<br/>[JobManager.cs]"]
  node_request["Backtest Request<br/>[BacktestRequest.cs]"]
  node_backtest["Backtest Orchestrator<br/>[BacktestService.cs]"]
end

subgraph group_market["Market Data"]
  node_assets["Asset Registry<br/>[AssetRegistry.cs]"]
  node_history["Historical Data Service"]
  node_validator["Data Validator<br/>[DataValidator.cs]"]
  node_cache[("Historical Data Cache")]
  node_provider["Historical Data Provider"]
  node_yahoo["Yahoo Provider"]
  node_upstox["Upstox Provider"]
end

subgraph group_engine["Backtest Execution"]
  node_lean["LEAN Runner<br/>[LeanRunner.cs]"]
  node_lean_engine["LEAN Engine"]
end

subgraph group_results["Results &amp; Analysis"]
  node_parser["Result Parser"]
  node_response["Backtest Results"]
  node_results_page["Results View"]
  node_charts["Charts &amp; Metrics"]
  node_explore["Parameter Exploration<br/>[Explore.jsx]"]
  node_compare["Strategy Comparison<br/>[Compare.jsx]"]
end

node_user(("Trader"))

node_user -->|"starts at"| node_dashboard
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_builder
node_app -->|"routes to"| node_parameters
node_app -->|"routes to"| node_loading
node_app -->|"routes to"| node_results_page
node_app -->|"routes to"| node_explore
node_app -->|"routes to"| node_compare
node_builder -->|"continues to"| node_parameters
node_parameters -.->|"submits to"| node_loading
node_builder -->|"uses"| node_api_client
node_api_client -.->|"submits request"| node_controller
node_controller -->|"accepts"| node_request
node_controller -->|"creates job"| node_jobs
node_controller -->|"starts run"| node_backtest
node_controller -->|"reads status"| node_jobs
node_backtest -->|"updates progress"| node_jobs
node_backtest -->|"requests data"| node_history
node_history -->|"resolves asset"| node_assets
node_history -->|"fetches candles"| node_provider
node_history -->|"validates data"| node_validator
node_history -->|"reads and writes"| node_cache
node_provider -->|"implemented by"| node_yahoo
node_provider -.->|"implemented by"| node_upstox
node_backtest -->|"executes with"| node_lean
node_lean -->|"runs on"| node_lean_engine
node_backtest -->|"parses output"| node_parser
node_parser -->|"builds"| node_response
node_backtest -->|"returns"| node_response
node_results_page -->|"renders"| node_charts
node_explore -->|"continues to"| node_compare
node_controller -.->|"returns job results"| node_api_client

click node_app "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/Dashboard.jsx"
click node_builder "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/StrategyBuilder.jsx"
click node_parameters "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/Parameters.jsx"
click node_loading "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/components/LoadingBacktest.jsx"
click node_api_client "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/api/backtest.js"
click node_controller "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Controllers/BacktestController.cs"
click node_jobs "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/JobManager.cs"
click node_request "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Models/BacktestRequest.cs"
click node_backtest "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/BacktestService.cs"
click node_assets "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/AssetRegistry.cs"
click node_history "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/HistoricalDataService.cs"
click node_validator "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/DataValidator.cs"
click node_cache "https://github.com/rishavrai563/algorithmic-trading-workbench/tree/main/lean_workspace/data/custom"
click node_provider "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/IHistoricalDataProvider.cs"
click node_yahoo "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/YahooHistoricalDataProvider.cs"
click node_upstox "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/UpstoxHistoricalDataProvider.cs"
click node_lean "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/LeanRunner.cs"
click node_parser "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/LeanResultParser.cs"
click node_response "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Models/BacktestResponse.cs"
click node_results_page "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/BacktestResults.jsx"
click node_charts "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/components/CandlestickChart.jsx"
click node_explore "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/Explore.jsx"
click node_compare "https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/Compare.jsx"

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_app,node_dashboard,node_builder,node_parameters,node_loading toneBlue
class node_api_client,node_controller,node_jobs,node_request,node_backtest toneAmber
class node_assets,node_history,node_validator,node_cache,node_provider,node_yahoo,node_upstox toneMint
class node_lean,node_lean_engine toneRose
class node_parser,node_response,node_results_page,node_charts,node_explore,node_compare,node_user toneIndigo
```

## Components

### Workbench UI

- [App & State](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Strategy Builder](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/StrategyBuilder.jsx): `frontend/src/pages/StrategyBuilder.jsx`
- [Parameters](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/Parameters.jsx): `frontend/src/pages/Parameters.jsx`
- [Run Progress](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/components/LoadingBacktest.jsx): `frontend/src/components/LoadingBacktest.jsx`

### Backtest API

- [Backtest Client](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/api/backtest.js): `frontend/src/api/backtest.js`
- [Backtest Controller](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Controllers/BacktestController.cs): `backend/Controllers/BacktestController.cs`
- [Job Manager](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/JobManager.cs): `backend/Services/JobManager.cs`
- [Backtest Request](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Models/BacktestRequest.cs): `backend/Models/BacktestRequest.cs`
- [Backtest Orchestrator](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/BacktestService.cs): `backend/Services/BacktestService.cs`

### Market Data

- [Asset Registry](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/AssetRegistry.cs): `backend/Services/AssetRegistry.cs`
- [Historical Data Service](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/HistoricalDataService.cs): `backend/Services/HistoricalDataService.cs`
- [Data Validator](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/DataValidator.cs): `backend/Services/DataValidator.cs`
- [Historical Data Cache](https://github.com/rishavrai563/algorithmic-trading-workbench/tree/main/lean_workspace/data/custom): `lean_workspace/data/custom`
- [Historical Data Provider](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/IHistoricalDataProvider.cs): `backend/Services/IHistoricalDataProvider.cs`
- [Yahoo Provider](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/YahooHistoricalDataProvider.cs): `backend/Services/YahooHistoricalDataProvider.cs`
- [Upstox Provider](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/UpstoxHistoricalDataProvider.cs): `backend/Services/UpstoxHistoricalDataProvider.cs`

### Backtest Execution

- [LEAN Runner](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/LeanRunner.cs): `backend/Services/LeanRunner.cs`
- **LEAN Engine**

### Results & Analysis

- [Result Parser](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Services/LeanResultParser.cs): `backend/Services/LeanResultParser.cs`
- [Backtest Results](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/backend/Models/BacktestResponse.cs): `backend/Models/BacktestResponse.cs`
- [Results View](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/BacktestResults.jsx): `frontend/src/pages/BacktestResults.jsx`
- [Charts & Metrics](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/components/CandlestickChart.jsx): `frontend/src/components/CandlestickChart.jsx`
- [Parameter Exploration](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/Explore.jsx): `frontend/src/pages/Explore.jsx`
- [Strategy Comparison](https://github.com/rishavrai563/algorithmic-trading-workbench/blob/main/frontend/src/pages/Compare.jsx): `frontend/src/pages/Compare.jsx`

### Other components

- **Trader**

## Connections

- Trader → Dashboard: starts at
- App & State → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App & State → Strategy Builder: routes to (evidence: `frontend/src/App.jsx`)
- App & State → Parameters: routes to (evidence: `frontend/src/App.jsx`)
- App & State → Run Progress: routes to (evidence: `frontend/src/App.jsx`)
- App & State → Results View: routes to (evidence: `frontend/src/App.jsx`)
- App & State → Parameter Exploration: routes to (evidence: `frontend/src/App.jsx`)
- App & State → Strategy Comparison: routes to (evidence: `frontend/src/App.jsx`)
- Strategy Builder → Parameters: continues to
- Parameters → Run Progress: submits to
- Strategy Builder → Backtest Client: uses (evidence: `frontend/src/pages/StrategyBuilder.jsx`)
- Backtest Client → Backtest Controller: submits request
- Backtest Controller → Backtest Request: accepts (evidence: `backend/Controllers/BacktestController.cs`)
- Backtest Controller → Job Manager: creates job (evidence: `backend/Controllers/BacktestController.cs`)
- Backtest Controller → Backtest Orchestrator: starts run (evidence: `backend/Controllers/BacktestController.cs`)
- Backtest Controller → Job Manager: reads status (evidence: `backend/Controllers/BacktestController.cs`)
- Backtest Orchestrator → Job Manager: updates progress (evidence: `backend/Services/BacktestService.cs`)
- Backtest Orchestrator → Historical Data Service: requests data (evidence: `backend/Services/BacktestService.cs`)
- Historical Data Service → Asset Registry: resolves asset (evidence: `backend/Services/HistoricalDataService.cs`)
- Historical Data Service → Historical Data Provider: fetches candles (evidence: `backend/Services/HistoricalDataService.cs`)
- Historical Data Service → Data Validator: validates data (evidence: `backend/Services/HistoricalDataService.cs`)
- Historical Data Service → Historical Data Cache: reads and writes (evidence: `backend/Services/HistoricalDataService.cs`)
- Historical Data Provider → Yahoo Provider: implemented by (evidence: `backend/Program.cs`)
- Historical Data Provider → Upstox Provider: implemented by (evidence: `backend/Services/UpstoxHistoricalDataProvider.cs`)
- Backtest Orchestrator → LEAN Runner: executes with (evidence: `backend/Services/BacktestService.cs`)
- LEAN Runner → LEAN Engine: runs on
- Backtest Orchestrator → Result Parser: parses output (evidence: `backend/Services/BacktestService.cs`)
- Result Parser → Backtest Results: builds (evidence: `backend/Services/LeanResultParser.cs`)
- Backtest Orchestrator → Backtest Results: returns (evidence: `backend/Services/BacktestService.cs`)
- Results View → Charts & Metrics: renders (evidence: `frontend/src/pages/BacktestResults.jsx`)
- Parameter Exploration → Strategy Comparison: continues to
- Backtest Controller → Backtest Client: returns job results
