# ravindhu/algo-pro architecture

> Architecture diagram of the GitHub repository ravindhu/algo-pro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ravindhu/algo-pro
- Repository: https://github.com/ravindhu/algo-pro

## Overview

Algo Pro is an Indian-market quant trading system with a documented path from market data and signals through portfolio sizing, safety checks, order execution, and post-trade monitoring. The README also describes research, feedback, audit, and dashboard capabilities; some referenced packages are absent from the supplied tree, so those are represented only where an existing enclosing directory supports them. The older Blue_engine pipeline is separately documented in its source excerpt. Edges use README or excerpt evidence; unsampled implementation details are not inferred.

Main entry points: [`Blue_engine/core/pipeline.py`](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/core/pipeline.py) (Stage orchestrator), [`Blue_engine/core/risk_gate.py`](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/core/risk_gate.py) (Safety gate), [`src/quant/models`](https://github.com/ravindhu/algo-pro/tree/master/src/quant/models) (Signals and conviction), [`src/quant/monitor`](https://github.com/ravindhu/algo-pro/tree/master/src/quant/monitor) (TCA and health)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Data and analysis"]
  node_market_inputs["Market inputs<br/>[market_inputs.py]"]
  node_data_features["Data and features"]
  node_signal_models["Signals and conviction"]
  node_event_scoring["Event scoring"]
  node_research["Research validation"]
end

subgraph group_decision["Portfolio and safety"]
  node_sizing["Sizing and allocation"]
  node_portfolio_risk["Portfolio risk<br/>[risk_engine.py]"]
  node_session_guards["Session guards"]
  node_risk_gate{{"Safety gate<br/>[risk_gate.py]"}}
  node_pretrade["Pre-trade checks"]
end

subgraph group_execution["Execution"]
  node_order_queue["Order queue<br/>[queue.py]"]
  node_order_router["Order router<br/>[router.py]"]
  node_openalgo_client["OpenAlgo client<br/>[openalgo_client.py]"]
end

subgraph group_operations["Monitoring and learning"]
  node_ledger_recon[("Ledger and recon<br/>[ledger.py]")]
  node_tca_health["TCA and health"]
  node_kill_switch["Kill switch<br/>[safe_mode.py]"]
  node_feedback["Model improvement"]
  node_audit[("Audit logs")]
  node_dashboard["Operations dashboard<br/>[app.py]"]
end

subgraph group_legacy["Blue_engine pipeline"]
  node_pipeline["Stage orchestrator<br/>[pipeline.py]"]
  node_economic["Economic regime<br/>[economic_engine.py]"]
  node_market_engine["Market analysis<br/>[market_engine.py]"]
  node_screener["Universe screener<br/>[screener_engine.py]"]
  node_valuation["Valuation"]
  node_legacy_portfolio["Portfolio engine"]
  node_alpha["Alpha engine<br/>[alpha_engine.py]"]
  node_pov["POV execution<br/>[pov_engine.py]"]
  node_infrastructure["Infrastructure engine"]
end

node_broker["Broker platform"]
node_operator(("Operator"))

node_market_inputs -->|"feeds"| node_data_features
node_data_features -->|"feeds"| node_signal_models
node_signal_models -->|"informs"| node_sizing
node_signal_models -.->|"advises"| node_event_scoring
node_sizing -->|"allocates for"| node_portfolio_risk
node_portfolio_risk -->|"passes to"| node_session_guards
node_session_guards -->|"passes to"| node_pretrade
node_pretrade -->|"checks at"| node_risk_gate
node_risk_gate -->|"dispatches to"| node_order_queue
node_order_queue -->|"routes via"| node_order_router
node_order_router -->|"calls"| node_openalgo_client
node_openalgo_client -->|"sends orders"| node_broker
node_broker -->|"reconciles through"| node_ledger_recon
node_ledger_recon -->|"feeds"| node_tca_health
node_tca_health -->|"triggers on breach"| node_kill_switch
node_kill_switch -->|"blocks at"| node_risk_gate
node_tca_health -.->|"informs"| node_feedback
node_operator -.->|"operates"| node_dashboard
node_dashboard -.->|"presents"| node_ledger_recon
node_operator -.->|"records overrides"| node_audit
node_research -.->|"validates"| node_feedback
node_pipeline -->|"runs stage"| node_economic
node_pipeline -->|"runs stage"| node_market_engine
node_pipeline -->|"runs stage"| node_screener
node_pipeline -->|"runs stage"| node_valuation
node_pipeline -->|"runs stage"| node_legacy_portfolio
node_pipeline -->|"runs stage"| node_alpha
node_pipeline -->|"runs stage"| node_risk_gate
node_pipeline -->|"runs stage"| node_pov
node_pipeline -->|"runs stage"| node_infrastructure

click node_market_inputs "https://github.com/ravindhu/algo-pro/blob/master/src/quant/data/market_inputs.py"
click node_data_features "https://github.com/ravindhu/algo-pro/tree/master/src/quant/data"
click node_signal_models "https://github.com/ravindhu/algo-pro/tree/master/src/quant/models"
click node_event_scoring "https://github.com/ravindhu/algo-pro/tree/master/src/quant/models/events"
click node_research "https://github.com/ravindhu/algo-pro/tree/master/src/quant"
click node_sizing "https://github.com/ravindhu/algo-pro/tree/master/src/quant/portfolio"
click node_portfolio_risk "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/core/risk_engine.py"
click node_session_guards "https://github.com/ravindhu/algo-pro/tree/master/src/quant/core"
click node_risk_gate "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/core/risk_gate.py"
click node_pretrade "https://github.com/ravindhu/algo-pro/tree/master/src/quant/execution"
click node_order_queue "https://github.com/ravindhu/algo-pro/blob/master/src/quant/execution/queue.py"
click node_order_router "https://github.com/ravindhu/algo-pro/blob/master/src/quant/execution/router.py"
click node_openalgo_client "https://github.com/ravindhu/algo-pro/blob/master/src/quant/execution/openalgo_client.py"
click node_ledger_recon "https://github.com/ravindhu/algo-pro/blob/master/src/quant/monitor/ledger.py"
click node_tca_health "https://github.com/ravindhu/algo-pro/tree/master/src/quant/monitor"
click node_kill_switch "https://github.com/ravindhu/algo-pro/blob/master/src/quant/monitor/safe_mode.py"
click node_feedback "https://github.com/ravindhu/algo-pro/tree/master/src/quant/feedback"
click node_audit "https://github.com/ravindhu/algo-pro/tree/master/src/quant/audit"
click node_dashboard "https://github.com/ravindhu/algo-pro/blob/master/dashboard/app.py"
click node_pipeline "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/core/pipeline.py"
click node_economic "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/economics/economic_engine.py"
click node_market_engine "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/market/market_engine.py"
click node_screener "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/screener/screener_engine.py"
click node_valuation "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/valuation_engine.py"
click node_legacy_portfolio "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/portfolio/portfolio_engine.py"
click node_alpha "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/alpha/alpha_engine.py"
click node_pov "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/pov/pov_engine.py"
click node_infrastructure "https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/infrastructure/infrastructure_engine.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_market_inputs,node_data_features,node_signal_models,node_event_scoring,node_research toneBlue
class node_sizing,node_portfolio_risk,node_session_guards,node_risk_gate,node_pretrade toneAmber
class node_order_queue,node_order_router,node_openalgo_client toneMint
class node_ledger_recon,node_tca_health,node_kill_switch,node_feedback,node_audit,node_dashboard toneRose
class node_pipeline,node_economic,node_market_engine,node_screener,node_valuation,node_legacy_portfolio,node_alpha,node_pov,node_infrastructure,node_broker,node_operator toneIndigo
```

## Components

### Data and analysis

- [Market inputs](https://github.com/ravindhu/algo-pro/blob/master/src/quant/data/market_inputs.py): `src/quant/data/market_inputs.py`
- [Data and features](https://github.com/ravindhu/algo-pro/tree/master/src/quant/data): `src/quant/data`
- [Signals and conviction](https://github.com/ravindhu/algo-pro/tree/master/src/quant/models): `src/quant/models`
- [Event scoring](https://github.com/ravindhu/algo-pro/tree/master/src/quant/models/events): `src/quant/models/events`
- [Research validation](https://github.com/ravindhu/algo-pro/tree/master/src/quant): `src/quant`

### Portfolio and safety

- [Sizing and allocation](https://github.com/ravindhu/algo-pro/tree/master/src/quant/portfolio): `src/quant/portfolio`
- [Portfolio risk](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/core/risk_engine.py): `Blue_engine/core/risk_engine.py`
- [Session guards](https://github.com/ravindhu/algo-pro/tree/master/src/quant/core): `src/quant/core`
- [Safety gate](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/core/risk_gate.py): `Blue_engine/core/risk_gate.py`
- [Pre-trade checks](https://github.com/ravindhu/algo-pro/tree/master/src/quant/execution): `src/quant/execution`

### Execution

- [Order queue](https://github.com/ravindhu/algo-pro/blob/master/src/quant/execution/queue.py): `src/quant/execution/queue.py`
- [Order router](https://github.com/ravindhu/algo-pro/blob/master/src/quant/execution/router.py): `src/quant/execution/router.py`
- [OpenAlgo client](https://github.com/ravindhu/algo-pro/blob/master/src/quant/execution/openalgo_client.py): `src/quant/execution/openalgo_client.py`

### Monitoring and learning

- [Ledger and recon](https://github.com/ravindhu/algo-pro/blob/master/src/quant/monitor/ledger.py): `src/quant/monitor/ledger.py`
- [TCA and health](https://github.com/ravindhu/algo-pro/tree/master/src/quant/monitor): `src/quant/monitor`
- [Kill switch](https://github.com/ravindhu/algo-pro/blob/master/src/quant/monitor/safe_mode.py): `src/quant/monitor/safe_mode.py`
- [Model improvement](https://github.com/ravindhu/algo-pro/tree/master/src/quant/feedback): `src/quant/feedback`
- [Audit logs](https://github.com/ravindhu/algo-pro/tree/master/src/quant/audit): `src/quant/audit`
- [Operations dashboard](https://github.com/ravindhu/algo-pro/blob/master/dashboard/app.py): `dashboard/app.py`

### Blue_engine pipeline

- [Stage orchestrator](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/core/pipeline.py): `Blue_engine/core/pipeline.py`
- [Economic regime](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/economics/economic_engine.py): `Blue_engine/economics/economic_engine.py`
- [Market analysis](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/market/market_engine.py): `Blue_engine/market/market_engine.py`
- [Universe screener](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/screener/screener_engine.py): `Blue_engine/screener/screener_engine.py`
- [Valuation](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/valuation_engine.py): `Blue_engine/valuation_engine.py`
- [Portfolio engine](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/portfolio/portfolio_engine.py): `Blue_engine/portfolio/portfolio_engine.py`
- [Alpha engine](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/alpha/alpha_engine.py): `Blue_engine/alpha/alpha_engine.py`
- [POV execution](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/pov/pov_engine.py): `Blue_engine/pov/pov_engine.py`
- [Infrastructure engine](https://github.com/ravindhu/algo-pro/blob/master/Blue_engine/infrastructure/infrastructure_engine.py): `Blue_engine/infrastructure/infrastructure_engine.py`

### Other components

- **Broker platform**
- **Operator**

## Connections

- Market inputs → Data and features: feeds
- Data and features → Signals and conviction: feeds
- Signals and conviction → Sizing and allocation: informs
- Signals and conviction → Event scoring: advises
- Sizing and allocation → Portfolio risk: allocates for
- Portfolio risk → Session guards: passes to
- Session guards → Pre-trade checks: passes to (evidence: `src/quant/execution/pov_engine.py`)
- Pre-trade checks → Safety gate: checks at
- Safety gate → Order queue: dispatches to
- Order queue → Order router: routes via
- Order router → OpenAlgo client: calls
- OpenAlgo client → Broker platform: sends orders
- Broker platform → Ledger and recon: reconciles through
- Ledger and recon → TCA and health: feeds
- TCA and health → Kill switch: triggers on breach
- Kill switch → Safety gate: blocks at
- TCA and health → Model improvement: informs
- Operator → Operations dashboard: operates
- Operations dashboard → Ledger and recon: presents (evidence: `dashboard/app.py`)
- Operator → Audit logs: records overrides
- Research validation → Model improvement: validates
- Stage orchestrator → Economic regime: runs stage (evidence: `Blue_engine/core/pipeline.py`)
- Stage orchestrator → Market analysis: runs stage (evidence: `Blue_engine/core/pipeline.py`)
- Stage orchestrator → Universe screener: runs stage (evidence: `Blue_engine/core/pipeline.py`)
- Stage orchestrator → Valuation: runs stage (evidence: `Blue_engine/core/pipeline.py`)
- Stage orchestrator → Portfolio engine: runs stage (evidence: `Blue_engine/core/pipeline.py`)
- Stage orchestrator → Alpha engine: runs stage (evidence: `Blue_engine/core/pipeline.py`)
- Stage orchestrator → Safety gate: runs stage (evidence: `Blue_engine/core/pipeline.py`)
- Stage orchestrator → POV execution: runs stage (evidence: `Blue_engine/core/pipeline.py`)
- Stage orchestrator → Infrastructure engine: runs stage (evidence: `Blue_engine/core/pipeline.py`)
