# shamanth-8/tradeo architecture

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

- Interactive diagram: https://gitdiagram.com/shamanth-8/tradeo
- Repository: https://github.com/shamanth-8/tradeo

## Overview

Tradeo is a local-first Indian-market assistant and paper-trading lab. Users interact through the web app or voice/chat; the backend serves analysis and market-data features, while optional scanning and trading agents produce ideas, apply pre-trade checks, and record virtual-account results. The product also includes a pluggable research engine, strategy backtesting, broker-based holdings access, and alerts. The README documents the main product flows; several route and subsystem implementations were not sampled, so their internal links are omitted.

Main entry points: [`backend/main.py`](https://github.com/shamanth-8/tradeo/blob/main/backend/main.py) (FastAPI backend), [`frontend/src/App.jsx`](https://github.com/shamanth-8/tradeo/blob/main/frontend/src/App.jsx) (Tradeo web app), [`backend/lowlatency/ingest.py`](https://github.com/shamanth-8/tradeo/blob/main/backend/lowlatency/ingest.py) (Tick ingestion), [`backend/agents/library.py`](https://github.com/shamanth-8/tradeo/blob/main/backend/agents/library.py) (Trading agents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["App and API"]
  node_webapp["Tradeo web app<br/>[App.jsx]"]
  node_api["FastAPI backend<br/>[main.py]"]
  node_routes["Product API routes"]
  node_voice["Voice interface<br/>[engine.py]"]
end

subgraph group_market["Market intelligence"]
  node_marketdata["Market data<br/>[stock_fetcher.py]"]
  node_newsdata["News data<br/>[news_fetcher.py]"]
  node_scanner["Watchtower scanner<br/>[scanner.py]"]
  node_realtime["Watchtower scheduler<br/>[engine.py]"]
  node_lowlatency["Tick ingestion<br/>[ingest.py]"]
  node_eventbus["Low-latency bus<br/>[bus.py]"]
end

subgraph group_trading["Agents and paper trading"]
  node_paper[("Paper account<br/>[database.py]")]
  node_autopilot["Autopilot controls<br/>[scheduler.py]"]
  node_agents["Trading agents<br/>[library.py]"]
  node_pretrade["Pre-trade checks<br/>[pretrade.py]"]
  node_pipeline["Watchtower pipeline<br/>[watchtower.py]"]
  node_backtest["Backtesting<br/>[backtest.py]"]
  node_strategies["Strategy sandbox<br/>[engine.py]"]
end

subgraph group_research["AI and research"]
  node_ai["Local AI assistant<br/>[brain.py]"]
  node_researchengine["Research engine<br/>[research_engine.py]"]
  node_factorzoo["Factor library<br/>[registry.py]"]
end

node_investor(("Investor"))
node_dhan["Dhan market feed"]
node_telegram["Telegram alerts<br/>[telegram.py]"]

node_investor -->|"uses"| node_webapp
node_investor -->|"speaks to"| node_voice
node_webapp -.->|"requests data"| node_api
node_api -->|"registers routes"| node_routes
node_api -->|"starts and checks"| node_researchengine
node_marketdata -->|"feeds market data"| node_scanner
node_newsdata -->|"supplies news"| node_scanner
node_realtime -->|"runs scans"| node_scanner
node_realtime -->|"publishes alerts"| node_telegram
node_autopilot -->|"starts agents"| node_agents
node_agents -->|"checks ideas"| node_pretrade
node_agents -->|"records trades"| node_paper
node_pretrade -->|"approves trades"| node_paper
node_pipeline -->|"backtests candidates"| node_backtest
node_routes -->|"runs pipeline"| node_pipeline
node_strategies -->|"uses backtester"| node_backtest
node_api -->|"starts ingestion"| node_lowlatency
node_lowlatency -->|"receives feed"| node_dhan
node_lowlatency -->|"publishes ticks"| node_eventbus
node_webapp -->|"offers chat"| node_ai
node_researchengine -.->|"provides research"| node_factorzoo
node_investor -->|"reviews results"| node_paper

click node_webapp "https://github.com/shamanth-8/tradeo/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/shamanth-8/tradeo/blob/main/backend/main.py"
click node_routes "https://github.com/shamanth-8/tradeo/tree/main/backend/api/routes"
click node_voice "https://github.com/shamanth-8/tradeo/blob/main/backend/voice/engine.py"
click node_marketdata "https://github.com/shamanth-8/tradeo/blob/main/backend/data/fetchers/stock_fetcher.py"
click node_newsdata "https://github.com/shamanth-8/tradeo/blob/main/backend/data/fetchers/news_fetcher.py"
click node_scanner "https://github.com/shamanth-8/tradeo/blob/main/backend/realtime/scanner.py"
click node_realtime "https://github.com/shamanth-8/tradeo/blob/main/backend/realtime/engine.py"
click node_paper "https://github.com/shamanth-8/tradeo/blob/main/backend/data/storage/database.py"
click node_autopilot "https://github.com/shamanth-8/tradeo/blob/main/backend/autopilot/scheduler.py"
click node_agents "https://github.com/shamanth-8/tradeo/blob/main/backend/agents/library.py"
click node_pretrade "https://github.com/shamanth-8/tradeo/blob/main/backend/pipeline/pretrade.py"
click node_pipeline "https://github.com/shamanth-8/tradeo/blob/main/backend/pipeline/watchtower.py"
click node_backtest "https://github.com/shamanth-8/tradeo/blob/main/backend/pipeline/backtest.py"
click node_strategies "https://github.com/shamanth-8/tradeo/blob/main/backend/strategies/engine.py"
click node_ai "https://github.com/shamanth-8/tradeo/blob/main/backend/ai/brain.py"
click node_researchengine "https://github.com/shamanth-8/tradeo/blob/main/backend/integrations/research_engine.py"
click node_factorzoo "https://github.com/shamanth-8/tradeo/blob/main/backend/research/src/factors/registry.py"
click node_lowlatency "https://github.com/shamanth-8/tradeo/blob/main/backend/lowlatency/ingest.py"
click node_eventbus "https://github.com/shamanth-8/tradeo/blob/main/backend/lowlatency/bus.py"
click node_telegram "https://github.com/shamanth-8/tradeo/blob/main/backend/integrations/telegram.py"

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_webapp,node_api,node_routes,node_voice toneBlue
class node_marketdata,node_newsdata,node_scanner,node_realtime,node_lowlatency,node_eventbus toneAmber
class node_paper,node_autopilot,node_agents,node_pretrade,node_pipeline,node_backtest,node_strategies toneMint
class node_ai,node_researchengine,node_factorzoo toneRose
class node_investor,node_dhan toneIndigo
class node_telegram toneTeal
```

## Components

### App and API

- [Tradeo web app](https://github.com/shamanth-8/tradeo/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [FastAPI backend](https://github.com/shamanth-8/tradeo/blob/main/backend/main.py): `backend/main.py`
- [Product API routes](https://github.com/shamanth-8/tradeo/tree/main/backend/api/routes): `backend/api/routes`
- [Voice interface](https://github.com/shamanth-8/tradeo/blob/main/backend/voice/engine.py): `backend/voice/engine.py`

### Market intelligence

- [Market data](https://github.com/shamanth-8/tradeo/blob/main/backend/data/fetchers/stock_fetcher.py): `backend/data/fetchers/stock_fetcher.py`
- [News data](https://github.com/shamanth-8/tradeo/blob/main/backend/data/fetchers/news_fetcher.py): `backend/data/fetchers/news_fetcher.py`
- [Watchtower scanner](https://github.com/shamanth-8/tradeo/blob/main/backend/realtime/scanner.py): `backend/realtime/scanner.py`
- [Watchtower scheduler](https://github.com/shamanth-8/tradeo/blob/main/backend/realtime/engine.py): `backend/realtime/engine.py`
- [Tick ingestion](https://github.com/shamanth-8/tradeo/blob/main/backend/lowlatency/ingest.py): `backend/lowlatency/ingest.py`
- [Low-latency bus](https://github.com/shamanth-8/tradeo/blob/main/backend/lowlatency/bus.py): `backend/lowlatency/bus.py`

### Agents and paper trading

- [Paper account](https://github.com/shamanth-8/tradeo/blob/main/backend/data/storage/database.py): `backend/data/storage/database.py`
- [Autopilot controls](https://github.com/shamanth-8/tradeo/blob/main/backend/autopilot/scheduler.py): `backend/autopilot/scheduler.py`
- [Trading agents](https://github.com/shamanth-8/tradeo/blob/main/backend/agents/library.py): `backend/agents/library.py`
- [Pre-trade checks](https://github.com/shamanth-8/tradeo/blob/main/backend/pipeline/pretrade.py): `backend/pipeline/pretrade.py`
- [Watchtower pipeline](https://github.com/shamanth-8/tradeo/blob/main/backend/pipeline/watchtower.py): `backend/pipeline/watchtower.py`
- [Backtesting](https://github.com/shamanth-8/tradeo/blob/main/backend/pipeline/backtest.py): `backend/pipeline/backtest.py`
- [Strategy sandbox](https://github.com/shamanth-8/tradeo/blob/main/backend/strategies/engine.py): `backend/strategies/engine.py`

### AI and research

- [Local AI assistant](https://github.com/shamanth-8/tradeo/blob/main/backend/ai/brain.py): `backend/ai/brain.py`
- [Research engine](https://github.com/shamanth-8/tradeo/blob/main/backend/integrations/research_engine.py): `backend/integrations/research_engine.py`
- [Factor library](https://github.com/shamanth-8/tradeo/blob/main/backend/research/src/factors/registry.py): `backend/research/src/factors/registry.py`

### Other components

- **Investor**
- **Dhan market feed**
- [Telegram alerts](https://github.com/shamanth-8/tradeo/blob/main/backend/integrations/telegram.py): `backend/integrations/telegram.py`

## Connections

- Investor → Tradeo web app: uses (evidence: `README.md`)
- Investor → Voice interface: speaks to (evidence: `README.md`)
- Tradeo web app → FastAPI backend: requests data
- FastAPI backend → Product API routes: registers routes (evidence: `backend/main.py`)
- FastAPI backend → Research engine: starts and checks (evidence: `backend/integrations/research_engine.py`)
- Market data → Watchtower scanner: feeds market data (evidence: `README.md`)
- News data → Watchtower scanner: supplies news (evidence: `README.md`)
- Watchtower scheduler → Watchtower scanner: runs scans (evidence: `backend/realtime/engine.py`)
- Watchtower scheduler → Telegram alerts: publishes alerts (evidence: `backend/realtime/engine.py`)
- Autopilot controls → Trading agents: starts agents (evidence: `README.md`)
- Trading agents → Pre-trade checks: checks ideas (evidence: `README.md`)
- Trading agents → Paper account: records trades (evidence: `README.md`)
- Pre-trade checks → Paper account: approves trades (evidence: `README.md`)
- Watchtower pipeline → Backtesting: backtests candidates (evidence: `backend/api/routes/pipeline.py`)
- Product API routes → Watchtower pipeline: runs pipeline (evidence: `backend/api/routes/pipeline.py`)
- Strategy sandbox → Backtesting: uses backtester (evidence: `backend/strategies/engine.py`)
- FastAPI backend → Tick ingestion: starts ingestion (evidence: `backend/main.py`)
- Tick ingestion → Dhan market feed: receives feed (evidence: `backend/lowlatency/ingest.py`)
- Tick ingestion → Low-latency bus: publishes ticks (evidence: `backend/lowlatency/ingest.py`)
- Tradeo web app → Local AI assistant: offers chat (evidence: `README.md`)
- Research engine → Factor library: provides research
- Investor → Paper account: reviews results (evidence: `README.md`)
