# abhi70802/agentic-trading-platform architecture

> Architecture diagram of the GitHub repository abhi70802/agentic-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/abhi70802/agentic-trading-platform
- Repository: https://github.com/abhi70802/agentic-trading-platform

## Overview

Northstar is a safe-first trading research platform: market data and supplied news are normalized into stored market and intelligence records, analyzed into hypotheses and calibrated risk decisions, then replayed or paper-executed under compliance and approval controls. Its connected runtime pipeline is optional and unset by default; live broker orders are disabled. The graph also preserves documented research capabilities and the local dashboard. Relationships for unsampled modules are included only where the README describes them; source excerpts provide additional implementation evidence.

Main entry points: [`runtime_pipeline.py`](https://github.com/abhi70802/agentic-trading-platform/blob/main/runtime_pipeline.py) (Runtime pipeline), [`api.py`](https://github.com/abhi70802/agentic-trading-platform/blob/main/api.py) (API), [`store.py`](https://github.com/abhi70802/agentic-trading-platform/blob/main/store.py) (SQLite store), [`ai_agents.py`](https://github.com/abhi70802/agentic-trading-platform/blob/main/ai_agents.py) (Strategy agents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Market data and research"]
  node_adapters["Provider adapters"]
  node_market["Market normalization<br/>[marketdata.py]"]
  node_features["Feature snapshots<br/>[features.py]"]
  node_india["India reference data<br/>[india_market.py]"]
  node_breadth["Market breadth<br/>[breadth.py]"]
  node_regime["India regime<br/>[india_regime.py]"]
  node_similarity["Historical similarity"]
  node_replay["Backtesting and replay<br/>[backtesting.py]"]
end

subgraph group_intelligence["Intelligence and hypotheses"]
  node_news["News intelligence<br/>[intelligence.py]"]
  node_agents["Strategy agents<br/>[ai_agents.py]"]
  node_llm["LLM gateway<br/>[llm_gateway.py]"]
end

subgraph group_decision["Risk and decisions"]
  node_calibration["Probability calibration"]
  node_decision_engine["Decision engine<br/>[decision_engine.py]"]
  node_economics["India cost model<br/>[india_economics.py]"]
  node_portfolio["Portfolio sizing<br/>[portfolio.py]"]
  node_compliance["Compliance policies<br/>[compliance.py]"]
end

subgraph group_execution["Execution and governance"]
  node_paper["Paper trading session<br/>[paper_trading.py]"]
  node_execution_service["Paper execution<br/>[execution.py]"]
  node_oms["Order management<br/>[oms.py]"]
  node_controlled["Controlled-live gate<br/>[controlled_live.py]"]
  node_broker_adapter["Broker adapter<br/>[broker_adapter.py]"]
  node_governance["Trade trace"]
end

subgraph group_platform["API and persistence"]
  node_runtime["Runtime pipeline"]
  node_store[("SQLite store<br/>[store.py]")]
  node_rag["Trading memory<br/>[rag.py]"]
  node_api["API<br/>[api.py]"]
  node_dashboard["Local dashboard<br/>[app.js]"]
end

node_user(("Research user"))
node_providers(("Data providers"))
node_broker(("Broker"))

node_providers -->|"supply data"| node_adapters
node_adapters -->|"normalize ticks"| node_market
node_market -->|"derive snapshots"| node_features
node_features -->|"persist audit events"| node_store
node_market -->|"store candles"| node_store
node_features -->|"measure participation"| node_breadth
node_features -->|"classify market"| node_regime
node_features -->|"find analogues"| node_similarity
node_market -->|"replay history"| node_replay
node_providers -->|"supply articles"| node_news
node_news -->|"persist intelligence"| node_store
node_news -->|"provide evidence"| node_agents
node_agents -->|"request hypotheses"| node_llm
node_llm -->|"return structured output"| node_agents
node_agents -->|"record decisions"| node_store
node_calibration -->|"supply probability"| node_decision_engine
node_decision_engine -->|"calculate costs"| node_economics
node_decision_engine -->|"size and screen"| node_portfolio
node_decision_engine -->|"evaluate policy"| node_compliance
node_runtime -->|"generate hypotheses"| node_agents
node_runtime -->|"calibrate history"| node_calibration
node_runtime -->|"evaluate candidate"| node_decision_engine
node_runtime -->|"submit paper decision"| node_paper
node_paper -->|"submit paper order"| node_execution_service
node_execution_service -->|"check controls"| node_compliance
node_execution_service -->|"check risk"| node_portfolio
node_execution_service -.->|"manage orders"| node_oms
node_runtime -->|"write trade journal"| node_store
node_runtime -->|"write trading memory"| node_rag
node_rag -->|"persist vectors"| node_store
node_runtime -->|"consult analogues"| node_similarity
node_runtime -->|"consult regime"| node_regime
node_runtime -->|"consult breadth"| node_breadth
node_runtime -->|"validate trade trace"| node_governance
node_governance -->|"store trace"| node_store
node_controlled -->|"submit gated order"| node_broker_adapter
node_broker_adapter -.->|"request broker action"| node_broker
node_api -.->|"serve market data"| node_market
node_api -->|"serve news endpoints"| node_news
node_api -->|"serve hypotheses"| node_agents
node_api -->|"serve memory search"| node_rag
node_api -->|"serve breadth"| node_breadth
node_api -->|"serve regime"| node_regime
node_api -->|"serve similarity"| node_similarity
node_api -.->|"read and write records"| node_store
node_user -->|"use dashboard"| node_dashboard
node_dashboard -.->|"call API"| node_api

click node_adapters "https://github.com/abhi70802/agentic-trading-platform/blob/main/angelone_adapter.py"
click node_market "https://github.com/abhi70802/agentic-trading-platform/blob/main/marketdata.py"
click node_features "https://github.com/abhi70802/agentic-trading-platform/blob/main/features.py"
click node_india "https://github.com/abhi70802/agentic-trading-platform/blob/main/india_market.py"
click node_breadth "https://github.com/abhi70802/agentic-trading-platform/blob/main/breadth.py"
click node_regime "https://github.com/abhi70802/agentic-trading-platform/blob/main/india_regime.py"
click node_similarity "https://github.com/abhi70802/agentic-trading-platform/blob/main/historical_similarity.py"
click node_replay "https://github.com/abhi70802/agentic-trading-platform/blob/main/backtesting.py"
click node_news "https://github.com/abhi70802/agentic-trading-platform/blob/main/intelligence.py"
click node_agents "https://github.com/abhi70802/agentic-trading-platform/blob/main/ai_agents.py"
click node_llm "https://github.com/abhi70802/agentic-trading-platform/blob/main/llm_gateway.py"
click node_calibration "https://github.com/abhi70802/agentic-trading-platform/blob/main/probability_calibration.py"
click node_decision_engine "https://github.com/abhi70802/agentic-trading-platform/blob/main/decision_engine.py"
click node_economics "https://github.com/abhi70802/agentic-trading-platform/blob/main/india_economics.py"
click node_portfolio "https://github.com/abhi70802/agentic-trading-platform/blob/main/portfolio.py"
click node_compliance "https://github.com/abhi70802/agentic-trading-platform/blob/main/compliance.py"
click node_paper "https://github.com/abhi70802/agentic-trading-platform/blob/main/paper_trading.py"
click node_execution_service "https://github.com/abhi70802/agentic-trading-platform/blob/main/execution.py"
click node_oms "https://github.com/abhi70802/agentic-trading-platform/blob/main/oms.py"
click node_controlled "https://github.com/abhi70802/agentic-trading-platform/blob/main/controlled_live.py"
click node_broker_adapter "https://github.com/abhi70802/agentic-trading-platform/blob/main/broker_adapter.py"
click node_governance "https://github.com/abhi70802/agentic-trading-platform/blob/main/trade_governance.py"
click node_runtime "https://github.com/abhi70802/agentic-trading-platform/blob/main/runtime_pipeline.py"
click node_store "https://github.com/abhi70802/agentic-trading-platform/blob/main/store.py"
click node_rag "https://github.com/abhi70802/agentic-trading-platform/blob/main/rag.py"
click node_api "https://github.com/abhi70802/agentic-trading-platform/blob/main/api.py"
click node_dashboard "https://github.com/abhi70802/agentic-trading-platform/blob/main/static/app.js"

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_adapters,node_market,node_features,node_india,node_breadth,node_regime,node_similarity,node_replay,node_user toneBlue
class node_news,node_agents,node_llm toneAmber
class node_calibration,node_decision_engine,node_economics,node_portfolio,node_compliance toneMint
class node_paper,node_execution_service,node_oms,node_controlled,node_broker_adapter,node_governance toneRose
class node_runtime,node_store,node_rag,node_api,node_dashboard,node_providers,node_broker toneIndigo
```

## Components

### Market data and research

- [Provider adapters](https://github.com/abhi70802/agentic-trading-platform/blob/main/angelone_adapter.py): `angelone_adapter.py`
- [Market normalization](https://github.com/abhi70802/agentic-trading-platform/blob/main/marketdata.py): `marketdata.py`
- [Feature snapshots](https://github.com/abhi70802/agentic-trading-platform/blob/main/features.py): `features.py`
- [India reference data](https://github.com/abhi70802/agentic-trading-platform/blob/main/india_market.py): `india_market.py`
- [Market breadth](https://github.com/abhi70802/agentic-trading-platform/blob/main/breadth.py): `breadth.py`
- [India regime](https://github.com/abhi70802/agentic-trading-platform/blob/main/india_regime.py): `india_regime.py`
- [Historical similarity](https://github.com/abhi70802/agentic-trading-platform/blob/main/historical_similarity.py): `historical_similarity.py`
- [Backtesting and replay](https://github.com/abhi70802/agentic-trading-platform/blob/main/backtesting.py): `backtesting.py`

### Intelligence and hypotheses

- [News intelligence](https://github.com/abhi70802/agentic-trading-platform/blob/main/intelligence.py): `intelligence.py`
- [Strategy agents](https://github.com/abhi70802/agentic-trading-platform/blob/main/ai_agents.py): `ai_agents.py`
- [LLM gateway](https://github.com/abhi70802/agentic-trading-platform/blob/main/llm_gateway.py): `llm_gateway.py`

### Risk and decisions

- [Probability calibration](https://github.com/abhi70802/agentic-trading-platform/blob/main/probability_calibration.py): `probability_calibration.py`
- [Decision engine](https://github.com/abhi70802/agentic-trading-platform/blob/main/decision_engine.py): `decision_engine.py`
- [India cost model](https://github.com/abhi70802/agentic-trading-platform/blob/main/india_economics.py): `india_economics.py`
- [Portfolio sizing](https://github.com/abhi70802/agentic-trading-platform/blob/main/portfolio.py): `portfolio.py`
- [Compliance policies](https://github.com/abhi70802/agentic-trading-platform/blob/main/compliance.py): `compliance.py`

### Execution and governance

- [Paper trading session](https://github.com/abhi70802/agentic-trading-platform/blob/main/paper_trading.py): `paper_trading.py`
- [Paper execution](https://github.com/abhi70802/agentic-trading-platform/blob/main/execution.py): `execution.py`
- [Order management](https://github.com/abhi70802/agentic-trading-platform/blob/main/oms.py): `oms.py`
- [Controlled-live gate](https://github.com/abhi70802/agentic-trading-platform/blob/main/controlled_live.py): `controlled_live.py`
- [Broker adapter](https://github.com/abhi70802/agentic-trading-platform/blob/main/broker_adapter.py): `broker_adapter.py`
- [Trade trace](https://github.com/abhi70802/agentic-trading-platform/blob/main/trade_governance.py): `trade_governance.py`

### API and persistence

- [Runtime pipeline](https://github.com/abhi70802/agentic-trading-platform/blob/main/runtime_pipeline.py): `runtime_pipeline.py`
- [SQLite store](https://github.com/abhi70802/agentic-trading-platform/blob/main/store.py): `store.py`
- [Trading memory](https://github.com/abhi70802/agentic-trading-platform/blob/main/rag.py): `rag.py`
- [API](https://github.com/abhi70802/agentic-trading-platform/blob/main/api.py): `api.py`
- [Local dashboard](https://github.com/abhi70802/agentic-trading-platform/blob/main/static/app.js): `static/app.js`

### Other components

- **Research user**
- **Data providers**
- **Broker**

## Connections

- Data providers → Provider adapters: supply data (evidence: `README.md`)
- Provider adapters → Market normalization: normalize ticks (evidence: `README.md`)
- Market normalization → Feature snapshots: derive snapshots (evidence: `README.md`)
- Feature snapshots → SQLite store: persist audit events (evidence: `README.md`)
- Market normalization → SQLite store: store candles (evidence: `README.md`)
- Feature snapshots → Market breadth: measure participation (evidence: `README.md`)
- Feature snapshots → India regime: classify market (evidence: `README.md`)
- Feature snapshots → Historical similarity: find analogues (evidence: `README.md`)
- Market normalization → Backtesting and replay: replay history (evidence: `README.md`)
- Data providers → News intelligence: supply articles (evidence: `README.md`)
- News intelligence → SQLite store: persist intelligence (evidence: `README.md`)
- News intelligence → Strategy agents: provide evidence (evidence: `README.md`)
- Strategy agents → LLM gateway: request hypotheses (evidence: `README.md`)
- LLM gateway → Strategy agents: return structured output (evidence: `README.md`)
- Strategy agents → SQLite store: record decisions (evidence: `README.md`)
- Probability calibration → Decision engine: supply probability (evidence: `README.md`)
- Decision engine → India cost model: calculate costs (evidence: `decision_engine.py`)
- Decision engine → Portfolio sizing: size and screen (evidence: `decision_engine.py`)
- Decision engine → Compliance policies: evaluate policy (evidence: `decision_engine.py`)
- Runtime pipeline → Strategy agents: generate hypotheses (evidence: `README.md`)
- Runtime pipeline → Probability calibration: calibrate history (evidence: `README.md`)
- Runtime pipeline → Decision engine: evaluate candidate (evidence: `README.md`)
- Runtime pipeline → Paper trading session: submit paper decision (evidence: `README.md`)
- Paper trading session → Paper execution: submit paper order (evidence: `paper_trading.py`)
- Paper execution → Compliance policies: check controls (evidence: `execution.py`)
- Paper execution → Portfolio sizing: check risk (evidence: `execution.py`)
- Paper execution → Order management: manage orders
- Runtime pipeline → SQLite store: write trade journal (evidence: `README.md`)
- Runtime pipeline → Trading memory: write trading memory (evidence: `README.md`)
- Trading memory → SQLite store: persist vectors (evidence: `README.md`)
- Runtime pipeline → Historical similarity: consult analogues (evidence: `README.md`)
- Runtime pipeline → India regime: consult regime (evidence: `README.md`)
- Runtime pipeline → Market breadth: consult breadth (evidence: `README.md`)
- Runtime pipeline → Trade trace: validate trade trace (evidence: `README.md`)
- Trade trace → SQLite store: store trace (evidence: `README.md`)
- Controlled-live gate → Broker adapter: submit gated order (evidence: `controlled_live.py`)
- Broker adapter → Broker: request broker action
- API → Market normalization: serve market data
- API → News intelligence: serve news endpoints (evidence: `README.md`)
- API → Strategy agents: serve hypotheses (evidence: `README.md`)
- API → Trading memory: serve memory search (evidence: `README.md`)
- API → Market breadth: serve breadth (evidence: `README.md`)
- API → India regime: serve regime (evidence: `README.md`)
- API → Historical similarity: serve similarity (evidence: `README.md`)
- API → SQLite store: read and write records
- Research user → Local dashboard: use dashboard (evidence: `README.md`)
- Local dashboard → API: call API
