# anmolrawat990/omegatrade-ai architecture

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

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

## Overview

This is a local multi-asset trading analysis system: market data is fetched, enriched with technical and operator-style features, evaluated by model and agent logic, then returned as signals, regime context, risk targets, and narrative briefing. The API exposes signal, Indian-market report, health, and backtest endpoints; historical backtesting is a separate analysis path. The README documents training and dashboard use. Some modules are indexed as imports but their full call behavior was not sampled, so only documented or excerpt-supported links are drawn.

Main entry points: [`engine/run.py`](https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/run.py) (Analysis Runner), [`api/server.py`](https://github.com/anmolrawat990/omegatrade-ai/blob/main/api/server.py) (API Server), [`engine/agents/base.py`](https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/base.py) (Agent Base), [`data/fetcher.py`](https://github.com/anmolrawat990/omegatrade-ai/blob/main/data/fetcher.py) (OHLCV Fetcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interfaces"]
  node_dashboard["Dashboard<br/>[index.html]"]
  node_api["API Server<br/>[server.py]"]
end

subgraph group_market["Market Data"]
  node_ohlcv["OHLCV Fetcher<br/>[fetcher.py]"]
  node_indian["Indian Market Catalog<br/>[indian_market.py]"]
  node_smartapi["SmartAPI Fetcher"]
  node_news["News Fetcher<br/>[news_fetcher.py]"]
end

subgraph group_analysis["Analysis Engine"]
  node_engine["Analysis Runner<br/>[run.py]"]
  node_config["Runtime Settings<br/>[config.py]"]
  node_technical["Technical Features<br/>[technical.py]"]
  node_operator["Operator Features<br/>[operator.py]"]
  node_base["Agent Base<br/>[base.py]"]
  node_signal["Signal Agent<br/>[signal.py]"]
  node_context["Context Agent<br/>[context.py]"]
  node_risk["Risk Agent<br/>[risk.py]"]
  node_decision["Decision Agent<br/>[decision.py]"]
  node_sentiment["News Sentiment<br/>[sentiment.py]"]
end

subgraph group_models["Models and Training"]
  node_xgb["XGBoost Model<br/>[train_xgb.py]"]
  node_lstm["LSTM Model<br/>[train_lstm.py]"]
  node_hmm["HMM Model<br/>[train_hmm.py]"]
  node_meta["Meta Model<br/>[train_meta.py]"]
end

subgraph group_evaluation["Reporting and Evaluation"]
  node_briefing["Narrative Briefing<br/>[briefing.py]"]
  node_indianreport["Indian Report<br/>[indian_report.py]"]
  node_backtest["Backtester<br/>[backtest.py]"]
end

node_user(("Analyst"))
node_ollama{{"Ollama"}}
node_marketprovider{{"Market Providers"}}

node_user -->|"views dashboard"| node_dashboard
node_user -->|"launches API"| node_api
node_dashboard -.->|"requests signals"| node_api
node_api -->|"runs analysis"| node_engine
node_engine -->|"creates fetchers"| node_ohlcv
node_engine -->|"uses features"| node_technical
node_engine -->|"uses features"| node_operator
node_engine -->|"creates agent"| node_signal
node_engine -->|"creates agent"| node_context
node_engine -->|"creates agent"| node_risk
node_engine -->|"creates agent"| node_decision
node_engine -.->|"loads model"| node_xgb
node_engine -.->|"loads model"| node_lstm
node_engine -.->|"loads model"| node_hmm
node_engine -.->|"loads model"| node_meta
node_engine -->|"uses sentiment"| node_sentiment
node_engine -->|"builds briefing"| node_briefing
node_briefing -->|"generates narrative"| node_ollama
node_api -->|"reads catalog"| node_indian
node_api -->|"requests report"| node_indianreport
node_indianreport -->|"uses quotes"| node_smartapi
node_api -->|"runs backtest"| node_backtest
node_api -->|"fetches candles"| node_ohlcv
node_ohlcv -->|"fetches market data"| node_marketprovider
node_smartapi -.->|"requests quotes"| node_marketprovider
node_sentiment -->|"analyzes news"| node_news
node_base -.->|"provides interface"| node_signal
node_base -->|"provides interface"| node_context
node_base -.->|"provides interface"| node_risk
node_base -.->|"provides interface"| node_decision
node_user -->|"trains models"| node_engine
node_user -->|"runs evaluation"| node_backtest

click node_dashboard "https://github.com/anmolrawat990/omegatrade-ai/blob/main/frontend/index.html"
click node_api "https://github.com/anmolrawat990/omegatrade-ai/blob/main/api/server.py"
click node_engine "https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/run.py"
click node_config "https://github.com/anmolrawat990/omegatrade-ai/blob/main/config.py"
click node_ohlcv "https://github.com/anmolrawat990/omegatrade-ai/blob/main/data/fetcher.py"
click node_indian "https://github.com/anmolrawat990/omegatrade-ai/blob/main/data/indian_market.py"
click node_smartapi "https://github.com/anmolrawat990/omegatrade-ai/blob/main/data/smartapi_fetcher.py"
click node_news "https://github.com/anmolrawat990/omegatrade-ai/blob/main/data/news_fetcher.py"
click node_technical "https://github.com/anmolrawat990/omegatrade-ai/blob/main/features/technical.py"
click node_operator "https://github.com/anmolrawat990/omegatrade-ai/blob/main/features/operator.py"
click node_base "https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/base.py"
click node_signal "https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/signal.py"
click node_context "https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/context.py"
click node_risk "https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/risk.py"
click node_decision "https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/decision.py"
click node_xgb "https://github.com/anmolrawat990/omegatrade-ai/blob/main/models/train_xgb.py"
click node_lstm "https://github.com/anmolrawat990/omegatrade-ai/blob/main/models/train_lstm.py"
click node_hmm "https://github.com/anmolrawat990/omegatrade-ai/blob/main/models/train_hmm.py"
click node_meta "https://github.com/anmolrawat990/omegatrade-ai/blob/main/models/train_meta.py"
click node_sentiment "https://github.com/anmolrawat990/omegatrade-ai/blob/main/nlp/sentiment.py"
click node_briefing "https://github.com/anmolrawat990/omegatrade-ai/blob/main/nlp/briefing.py"
click node_indianreport "https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/indian_report.py"
click node_backtest "https://github.com/anmolrawat990/omegatrade-ai/blob/main/backtests/backtest.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_dashboard,node_api toneBlue
class node_ohlcv,node_indian,node_smartapi,node_news toneAmber
class node_engine,node_config,node_technical,node_operator,node_base,node_signal,node_context,node_risk,node_decision,node_sentiment toneMint
class node_xgb,node_lstm,node_hmm,node_meta toneRose
class node_briefing,node_indianreport,node_backtest,node_user,node_ollama,node_marketprovider toneIndigo
```

## Components

### User Interfaces

- [Dashboard](https://github.com/anmolrawat990/omegatrade-ai/blob/main/frontend/index.html): `frontend/index.html`
- [API Server](https://github.com/anmolrawat990/omegatrade-ai/blob/main/api/server.py): `api/server.py`

### Market Data

- [OHLCV Fetcher](https://github.com/anmolrawat990/omegatrade-ai/blob/main/data/fetcher.py): `data/fetcher.py`
- [Indian Market Catalog](https://github.com/anmolrawat990/omegatrade-ai/blob/main/data/indian_market.py): `data/indian_market.py`
- [SmartAPI Fetcher](https://github.com/anmolrawat990/omegatrade-ai/blob/main/data/smartapi_fetcher.py): `data/smartapi_fetcher.py`
- [News Fetcher](https://github.com/anmolrawat990/omegatrade-ai/blob/main/data/news_fetcher.py): `data/news_fetcher.py`

### Analysis Engine

- [Analysis Runner](https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/run.py): `engine/run.py`
- [Runtime Settings](https://github.com/anmolrawat990/omegatrade-ai/blob/main/config.py): `config.py`
- [Technical Features](https://github.com/anmolrawat990/omegatrade-ai/blob/main/features/technical.py): `features/technical.py`
- [Operator Features](https://github.com/anmolrawat990/omegatrade-ai/blob/main/features/operator.py): `features/operator.py`
- [Agent Base](https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/base.py): `engine/agents/base.py`
- [Signal Agent](https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/signal.py): `engine/agents/signal.py`
- [Context Agent](https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/context.py): `engine/agents/context.py`
- [Risk Agent](https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/risk.py): `engine/agents/risk.py`
- [Decision Agent](https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/agents/decision.py): `engine/agents/decision.py`
- [News Sentiment](https://github.com/anmolrawat990/omegatrade-ai/blob/main/nlp/sentiment.py): `nlp/sentiment.py`

### Models and Training

- [XGBoost Model](https://github.com/anmolrawat990/omegatrade-ai/blob/main/models/train_xgb.py): `models/train_xgb.py`
- [LSTM Model](https://github.com/anmolrawat990/omegatrade-ai/blob/main/models/train_lstm.py): `models/train_lstm.py`
- [HMM Model](https://github.com/anmolrawat990/omegatrade-ai/blob/main/models/train_hmm.py): `models/train_hmm.py`
- [Meta Model](https://github.com/anmolrawat990/omegatrade-ai/blob/main/models/train_meta.py): `models/train_meta.py`

### Reporting and Evaluation

- [Narrative Briefing](https://github.com/anmolrawat990/omegatrade-ai/blob/main/nlp/briefing.py): `nlp/briefing.py`
- [Indian Report](https://github.com/anmolrawat990/omegatrade-ai/blob/main/engine/indian_report.py): `engine/indian_report.py`
- [Backtester](https://github.com/anmolrawat990/omegatrade-ai/blob/main/backtests/backtest.py): `backtests/backtest.py`

### Other components

- **Analyst**
- **Ollama**
- **Market Providers**

## Connections

- Analyst → Dashboard: views dashboard (evidence: `README.md`)
- Analyst → API Server: launches API (evidence: `README.md`)
- Dashboard → API Server: requests signals
- API Server → Analysis Runner: runs analysis (evidence: `api/server.py`)
- Analysis Runner → OHLCV Fetcher: creates fetchers (evidence: `engine/run.py`)
- Analysis Runner → Technical Features: uses features (evidence: `engine/run.py`)
- Analysis Runner → Operator Features: uses features (evidence: `engine/run.py`)
- Analysis Runner → Signal Agent: creates agent (evidence: `engine/run.py`)
- Analysis Runner → Context Agent: creates agent (evidence: `engine/run.py`)
- Analysis Runner → Risk Agent: creates agent (evidence: `engine/run.py`)
- Analysis Runner → Decision Agent: creates agent (evidence: `engine/run.py`)
- Analysis Runner → XGBoost Model: loads model (evidence: `engine/run.py`)
- Analysis Runner → LSTM Model: loads model (evidence: `engine/run.py`)
- Analysis Runner → HMM Model: loads model (evidence: `engine/run.py`)
- Analysis Runner → Meta Model: loads model (evidence: `engine/run.py`)
- Analysis Runner → News Sentiment: uses sentiment (evidence: `engine/run.py`)
- Analysis Runner → Narrative Briefing: builds briefing (evidence: `engine/run.py`)
- Narrative Briefing → Ollama: generates narrative (evidence: `README.md`)
- API Server → Indian Market Catalog: reads catalog (evidence: `api/server.py`)
- API Server → Indian Report: requests report (evidence: `api/server.py`)
- Indian Report → SmartAPI Fetcher: uses quotes (evidence: `engine/indian_report.py`)
- API Server → Backtester: runs backtest (evidence: `api/server.py`)
- API Server → OHLCV Fetcher: fetches candles (evidence: `api/server.py`)
- OHLCV Fetcher → Market Providers: fetches market data (evidence: `data/fetcher.py`)
- SmartAPI Fetcher → Market Providers: requests quotes
- News Sentiment → News Fetcher: analyzes news (evidence: `nlp/sentiment.py`)
- Agent Base → Signal Agent: provides interface (evidence: `engine/agents/signal.py`)
- Agent Base → Context Agent: provides interface (evidence: `engine/agents/context.py`)
- Agent Base → Risk Agent: provides interface (evidence: `engine/agents/risk.py`)
- Agent Base → Decision Agent: provides interface (evidence: `engine/agents/decision.py`)
- Analyst → Analysis Runner: trains models (evidence: `README.md`)
- Analyst → Backtester: runs evaluation (evidence: `README.md`)
