# white-trade-loan/algo-trading-platform architecture

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

- Interactive diagram: https://gitdiagram.com/white-trade-loan/algo-trading-platform
- Repository: https://github.com/white-trade-loan/algo-trading-platform

## Overview

Algo Trading is a self-hosted trading platform: traders build or configure strategies, test them in the sandbox, then route orders through a unified broker API. Its React application also provides options analytics and operational tools; the TypeScript server exposes health and API routes, with SQLite and optional Redis infrastructure. The README describes broader capabilities than the sampled backend implementation, and notes that many broker adapters and API endpoints are still in progress; links to those capabilities are documented rather than verified in source.

Main entry points: [`frontend/src/App.tsx`](https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/App.tsx) (React app), [`src/server/routes/api/v1.ts`](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/routes/api/v1.ts) (Unified broker API), [`src/server/main.ts`](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/main.ts) (HTTP server), [`src/cache/redis.ts`](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/cache/redis.ts) (Redis client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Trader application"]
  node_app["React app<br/>[App.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
  node_auth["Authentication state<br/>[authStore.ts]"]
end

subgraph group_strategy["Strategy surfaces"]
  node_flow["Visual strategy builder"]
  node_python["Python strategy host"]
  node_chartink["Chartink strategies"]
  node_sandbox["Sandbox and analyzer<br/>[Analyzer.tsx]"]
end

subgraph group_trading["Trading and analytics"]
  node_unified_api["Unified broker API<br/>[v1.ts]"]
  node_broker_registry["Broker registry<br/>[registry.ts]"]
  node_options["Options analytics<br/>[OptionChain.tsx]"]
  node_strategy_builder["Options strategy builder"]
  node_action_center["Order approval<br/>[ActionCenter.tsx]"]
  node_operations["Dashboards and alerts"]
  node_market_data["Live market data"]
end

subgraph group_server["Server and state"]
  node_server["HTTP server<br/>[main.ts]"]
  node_app_routes["Route assembly<br/>[app.ts]"]
  node_health["Health endpoint<br/>[health.ts]"]
  node_database[("SQLite databases<br/>[connection.ts]")]
  node_cache_store["Cache store<br/>[store.ts]"]
  node_redis["Redis client<br/>[redis.ts]"]
  node_settings["Server settings<br/>[settings.ts]"]
end

node_trader(("Trader"))
node_broker{{"Connected broker"}}
node_redis_service[("Redis service")]

node_trader -->|"uses"| node_app
node_app -->|"routes to"| node_options
node_app -->|"routes to"| node_strategy_builder
node_app -->|"routes to"| node_sandbox
node_app -->|"opens"| node_flow
node_app -->|"opens"| node_python
node_app -->|"opens"| node_chartink
node_app -.->|"uses"| node_api_client
node_api_client -->|"requests"| node_unified_api
node_trader -->|"integrates"| node_unified_api
node_unified_api -->|"consults"| node_broker_registry
node_broker_registry -.->|"dispatches"| node_broker
node_strategy_builder -->|"streams from"| node_market_data
node_options -->|"streams from"| node_market_data
node_flow -->|"sandbox trades"| node_sandbox
node_python -->|"sandbox trades"| node_sandbox
node_unified_api -->|"supports testing"| node_sandbox
node_trader -->|"reviews orders"| node_action_center
node_trader -->|"monitors"| node_operations
node_server -->|"serves"| node_app_routes
node_app_routes -->|"mounts"| node_health
node_app_routes -->|"mounts"| node_unified_api
node_server -->|"loads"| node_settings
node_server -->|"closes"| node_database
node_server -->|"closes"| node_redis
node_health -->|"checks"| node_database
node_health -->|"checks"| node_redis
node_cache_store -->|"uses"| node_redis
node_redis -.->|"connects to"| node_redis_service

click node_app "https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/api/client.ts"
click node_auth "https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/stores/authStore.ts"
click node_flow "https://github.com/white-trade-loan/algo-trading-platform/tree/main/frontend/src/pages/flow"
click node_python "https://github.com/white-trade-loan/algo-trading-platform/tree/main/frontend/src/pages/python-strategy"
click node_chartink "https://github.com/white-trade-loan/algo-trading-platform/tree/main/frontend/src/pages/chartink"
click node_sandbox "https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/pages/Analyzer.tsx"
click node_unified_api "https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/routes/api/v1.ts"
click node_broker_registry "https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/broker/registry.ts"
click node_options "https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/pages/OptionChain.tsx"
click node_strategy_builder "https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/pages/StrategyBuilder.tsx"
click node_action_center "https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/pages/ActionCenter.tsx"
click node_operations "https://github.com/white-trade-loan/algo-trading-platform/tree/main/frontend/src/pages/monitoring"
click node_market_data "https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/lib/MarketDataManager.ts"
click node_server "https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/main.ts"
click node_app_routes "https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/app.ts"
click node_health "https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/routes/health.ts"
click node_database "https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/db/connection.ts"
click node_cache_store "https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/cache/store.ts"
click node_redis "https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/cache/redis.ts"
click node_settings "https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/config/settings.ts"

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_api_client,node_auth toneBlue
class node_flow,node_python,node_chartink,node_sandbox,node_redis_service toneAmber
class node_unified_api,node_broker_registry,node_options,node_strategy_builder,node_action_center,node_operations,node_market_data toneMint
class node_server,node_app_routes,node_health,node_database,node_cache_store,node_redis,node_settings toneRose
class node_trader,node_broker toneIndigo
```

## Components

### Trader application

- [React app](https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Authentication state](https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/stores/authStore.ts): `frontend/src/stores/authStore.ts`

### Strategy surfaces

- [Visual strategy builder](https://github.com/white-trade-loan/algo-trading-platform/tree/main/frontend/src/pages/flow): `frontend/src/pages/flow`
- [Python strategy host](https://github.com/white-trade-loan/algo-trading-platform/tree/main/frontend/src/pages/python-strategy): `frontend/src/pages/python-strategy`
- [Chartink strategies](https://github.com/white-trade-loan/algo-trading-platform/tree/main/frontend/src/pages/chartink): `frontend/src/pages/chartink`
- [Sandbox and analyzer](https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/pages/Analyzer.tsx): `frontend/src/pages/Analyzer.tsx`

### Trading and analytics

- [Unified broker API](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/routes/api/v1.ts): `src/server/routes/api/v1.ts`
- [Broker registry](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/broker/registry.ts): `src/server/broker/registry.ts`
- [Options analytics](https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/pages/OptionChain.tsx): `frontend/src/pages/OptionChain.tsx`
- [Options strategy builder](https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/pages/StrategyBuilder.tsx): `frontend/src/pages/StrategyBuilder.tsx`
- [Order approval](https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/pages/ActionCenter.tsx): `frontend/src/pages/ActionCenter.tsx`
- [Dashboards and alerts](https://github.com/white-trade-loan/algo-trading-platform/tree/main/frontend/src/pages/monitoring): `frontend/src/pages/monitoring`
- [Live market data](https://github.com/white-trade-loan/algo-trading-platform/blob/main/frontend/src/lib/MarketDataManager.ts): `frontend/src/lib/MarketDataManager.ts`

### Server and state

- [HTTP server](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/main.ts): `src/server/main.ts`
- [Route assembly](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/app.ts): `src/server/app.ts`
- [Health endpoint](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/routes/health.ts): `src/server/routes/health.ts`
- [SQLite databases](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/db/connection.ts): `src/server/db/connection.ts`
- [Cache store](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/cache/store.ts): `src/cache/store.ts`
- [Redis client](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/cache/redis.ts): `src/cache/redis.ts`
- [Server settings](https://github.com/white-trade-loan/algo-trading-platform/blob/main/src/server/config/settings.ts): `src/server/config/settings.ts`

### Other components

- **Trader**
- **Connected broker**
- **Redis service**

## Connections

- Trader → React app: uses
- React app → Options analytics: routes to (evidence: `frontend/src/App.tsx`)
- React app → Options strategy builder: routes to (evidence: `frontend/src/App.tsx`)
- React app → Sandbox and analyzer: routes to (evidence: `frontend/src/App.tsx`)
- React app → Visual strategy builder: opens
- React app → Python strategy host: opens (evidence: `frontend/src/App.tsx`)
- React app → Chartink strategies: opens (evidence: `frontend/src/App.tsx`)
- React app → API client: uses
- API client → Unified broker API: requests
- Trader → Unified broker API: integrates
- Unified broker API → Broker registry: consults (evidence: `src/server/routes/api/v1.ts`)
- Broker registry → Connected broker: dispatches
- Options strategy builder → Live market data: streams from
- Options analytics → Live market data: streams from
- Visual strategy builder → Sandbox and analyzer: sandbox trades
- Python strategy host → Sandbox and analyzer: sandbox trades
- Unified broker API → Sandbox and analyzer: supports testing
- Trader → Order approval: reviews orders
- Trader → Dashboards and alerts: monitors
- HTTP server → Route assembly: serves (evidence: `src/server/main.ts`)
- Route assembly → Health endpoint: mounts (evidence: `src/server/app.ts`)
- Route assembly → Unified broker API: mounts (evidence: `src/server/app.ts`)
- HTTP server → Server settings: loads (evidence: `src/server/main.ts`)
- HTTP server → SQLite databases: closes (evidence: `src/server/main.ts`)
- HTTP server → Redis client: closes (evidence: `src/server/main.ts`)
- Health endpoint → SQLite databases: checks (evidence: `src/server/routes/health.ts`)
- Health endpoint → Redis client: checks (evidence: `src/server/routes/health.ts`)
- Cache store → Redis client: uses (evidence: `src/cache/store.ts`)
- Redis client → Redis service: connects to
