# himanshumohanty-git24/rakshaquant architecture

> Architecture diagram of the GitHub repository himanshumohanty-git24/rakshaquant, 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/himanshumohanty-git24/rakshaquant
- Repository: https://github.com/himanshumohanty-git24/rakshaquant

## Overview

RakshaQuant is a paper-trading research platform for NSE equities: three paired books receive the same signals, while deterministic, typed-model, and LLM advisors may veto entries. The session evaluates signals, applies risk controls, routes orders through a simulated broker, and records outcomes for replay and comparison. Operators use a token-protected web console or terminal dashboard to inspect and control runs. The graph preserves the documented market, risk, AI, experiment, and console capabilities; some links use README documentation because the corresponding implementation was not sampled.

Main entry points: [`src/decision/engine.py`](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/decision/engine.py) (Decision engine), [`src/engine/runner.py`](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/engine/runner.py) (Session engine), [`src/oms/oms.py`](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/oms/oms.py) (Order management), [`src/store/event_store.py`](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/store/event_store.py) (SQLite event store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Operator consoles"]
  node_web_console["Web console<br/>[routes.tsx]"]
  node_terminal_dashboard["Terminal dashboard<br/>[cli.py]"]
  node_web_api["Web API<br/>[server.py]"]
end

subgraph group_trading["Trading session"]
  node_run_manager["Run manager<br/>[run_manager.py]"]
  node_engine["Session engine<br/>[runner.py]"]
end

subgraph group_execution["Decision and execution"]
  node_strategies["Trade strategies<br/>[policy.py]"]
  node_decision_engine["Decision engine<br/>[engine.py]"]
  node_risk_engine["Risk engine<br/>[engine.py]"]
  node_oms["Order management<br/>[oms.py]"]
  node_exit_manager["Exit management<br/>[exit_manager.py]"]
  node_sim_broker["Simulated broker<br/>[broker.py]"]
end

subgraph group_intelligence["Data and AI"]
  node_market_data["Market data<br/>[history.py]"]
  node_features["Signal features<br/>[technical.py]"]
  node_advisors["Entry advisors<br/>[llm_veto.py]"]
  node_llm_router["LLM router<br/>[router.py]"]
  node_decision_models["Decision models<br/>[labels.py]"]
end

subgraph group_research["Records and research"]
  node_event_store[("SQLite event store<br/>[event_store.py]")]
  node_experiment["Experiment evaluation<br/>[experiment.py]"]
  node_backtesting["Backtesting<br/>[session.py]"]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_web_console
node_operator -->|"uses"| node_terminal_dashboard
node_web_console -.->|"requests data"| node_web_api
node_web_api -->|"routes control"| node_run_manager
node_run_manager -->|"starts run"| node_engine
node_terminal_dashboard -->|"reads events"| node_event_store
node_terminal_dashboard -->|"uses queries"| node_web_api
node_engine -->|"runs decisions"| node_decision_engine
node_engine -->|"uses feed"| node_market_data
node_engine -->|"records events"| node_event_store
node_decision_engine -->|"computes context"| node_features
node_decision_engine -->|"requests proposals"| node_strategies
node_decision_engine -->|"requests veto"| node_advisors
node_advisors -->|"requests completion"| node_llm_router
node_advisors -.->|"uses classifier"| node_decision_models
node_decision_engine -->|"submits orders"| node_oms
node_decision_engine -->|"tracks entries"| node_exit_manager
node_oms -->|"routes orders"| node_sim_broker
node_oms -.->|"checks risk"| node_risk_engine
node_exit_manager -->|"submits exits"| node_oms
node_event_store -.->|"supplies records"| node_experiment
node_event_store -->|"supplies replay"| node_backtesting

click node_web_console "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/frontend/src/app/routes.tsx"
click node_terminal_dashboard "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/dashboard/cli.py"
click node_web_api "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/web/server.py"
click node_run_manager "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/web/run_manager.py"
click node_engine "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/engine/runner.py"
click node_market_data "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/marketdata/history.py"
click node_features "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/features/technical.py"
click node_strategies "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/strategies/policy.py"
click node_decision_engine "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/decision/engine.py"
click node_advisors "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/decision/advisors/llm_veto.py"
click node_llm_router "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/llm/router.py"
click node_decision_models "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/decision_models/labels.py"
click node_risk_engine "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/risk/engine.py"
click node_oms "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/oms/oms.py"
click node_exit_manager "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/oms/exit_manager.py"
click node_sim_broker "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/brokers/simulated/broker.py"
click node_event_store "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/store/event_store.py"
click node_experiment "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/evaluation/experiment.py"
click node_backtesting "https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/backtesting/session.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_web_console,node_terminal_dashboard,node_web_api toneBlue
class node_run_manager,node_engine toneAmber
class node_strategies,node_decision_engine,node_risk_engine,node_oms,node_exit_manager,node_sim_broker toneMint
class node_market_data,node_features,node_advisors,node_llm_router,node_decision_models toneRose
class node_event_store,node_experiment,node_backtesting,node_operator toneIndigo
```

## Components

### Operator consoles

- [Web console](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/frontend/src/app/routes.tsx): `frontend/src/app/routes.tsx`
- [Terminal dashboard](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/dashboard/cli.py): `src/dashboard/cli.py`
- [Web API](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/web/server.py): `src/web/server.py`

### Trading session

- [Run manager](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/web/run_manager.py): `src/web/run_manager.py`
- [Session engine](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/engine/runner.py): `src/engine/runner.py`

### Decision and execution

- [Trade strategies](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/strategies/policy.py): `src/strategies/policy.py`
- [Decision engine](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/decision/engine.py): `src/decision/engine.py`
- [Risk engine](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/risk/engine.py): `src/risk/engine.py`
- [Order management](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/oms/oms.py): `src/oms/oms.py`
- [Exit management](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/oms/exit_manager.py): `src/oms/exit_manager.py`
- [Simulated broker](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/brokers/simulated/broker.py): `src/brokers/simulated/broker.py`

### Data and AI

- [Market data](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/marketdata/history.py): `src/marketdata/history.py`
- [Signal features](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/features/technical.py): `src/features/technical.py`
- [Entry advisors](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/decision/advisors/llm_veto.py): `src/decision/advisors/llm_veto.py`
- [LLM router](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/llm/router.py): `src/llm/router.py`
- [Decision models](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/decision_models/labels.py): `src/decision_models/labels.py`

### Records and research

- [SQLite event store](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/store/event_store.py): `src/store/event_store.py`
- [Experiment evaluation](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/evaluation/experiment.py): `src/evaluation/experiment.py`
- [Backtesting](https://github.com/himanshumohanty-git24/rakshaquant/blob/main/src/backtesting/session.py): `src/backtesting/session.py`

### Other components

- **Operator**

## Connections

- Operator → Web console: uses
- Operator → Terminal dashboard: uses
- Web console → Web API: requests data
- Web API → Run manager: routes control (evidence: `src/web/server.py`)
- Run manager → Session engine: starts run (evidence: `src/web/run_manager.py`)
- Terminal dashboard → SQLite event store: reads events (evidence: `src/dashboard/cli.py`)
- Terminal dashboard → Web API: uses queries (evidence: `src/dashboard/cli.py`)
- Session engine → Decision engine: runs decisions (evidence: `src/engine/runner.py`)
- Session engine → Market data: uses feed (evidence: `src/engine/runner.py`)
- Session engine → SQLite event store: records events (evidence: `src/engine/runner.py`)
- Decision engine → Signal features: computes context (evidence: `src/decision/engine.py`)
- Decision engine → Trade strategies: requests proposals (evidence: `src/decision/engine.py`)
- Decision engine → Entry advisors: requests veto (evidence: `src/decision/engine.py`)
- Entry advisors → LLM router: requests completion (evidence: `src/decision/advisors/llm_veto.py`)
- Entry advisors → Decision models: uses classifier
- Decision engine → Order management: submits orders (evidence: `src/decision/engine.py`)
- Decision engine → Exit management: tracks entries (evidence: `src/decision/engine.py`)
- Order management → Simulated broker: routes orders (evidence: `src/oms/oms.py`)
- Order management → Risk engine: checks risk
- Exit management → Order management: submits exits (evidence: `src/oms/exit_manager.py`)
- SQLite event store → Experiment evaluation: supplies records
- SQLite event store → Backtesting: supplies replay (evidence: `src/backtesting/session.py`)
