# ghanashyam06/marl architecture

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

- Interactive diagram: https://gitdiagram.com/ghanashyam06/marl
- Repository: https://github.com/ghanashyam06/marl

## Overview

Dual-Agent Stacked Stock Advisor turns ticker requests into calibrated PURCHASE/HOLD signals and risk suggestions. The main loop gathers daily prices, macro yields and sentiment, runs analysis in a process pool, then dispatches results to enabled output channels. Analysis combines short-term and long-term features, two classifiers and a calibrated stacking model; suggestions provide sizing and risk levels. The README also documents Supabase persistence and optional webhooks. Edges reflect the shown calls and documented outputs; the SQL schema and unsampled integrations are not expanded beyond those claims.

Main entry points: [`dual_agent_trader/main.py`](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/main.py) (Run coordinator), [`dual_agent_trader/notifier.py`](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/notifier.py) (Channel dispatcher), [`dual_agent_trader/model.py`](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/model.py) (Dual-agent ensemble), [`dual_agent_trader/data_provider.py`](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/data_provider.py) (Data providers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Run orchestration"]
  node_runner["Run coordinator<br/>[main.py]"]
end

subgraph group_data["Market data"]
  node_provider["Data providers<br/>[data_provider.py]"]
  node_market_api["Alpha Vantage"]
end

subgraph group_analysis["Signal analysis"]
  node_features["Feature engineering<br/>[features.py]"]
  node_ensemble["Dual-agent ensemble<br/>[model.py]"]
  node_suggestions["Risk suggestions<br/>[suggestions.py]"]
end

subgraph group_delivery["Signal delivery"]
  node_dispatcher["Channel dispatcher<br/>[notifier.py]"]
  node_terminal["Terminal output<br/>[notifier.py]"]
  node_supabase_adapter["Supabase adapter<br/>[notifier.py]"]
  node_signals_table[("Signals table<br/>[schema.sql]")]
  node_webhook_adapter["Webhook adapter<br/>[notifier.py]"]
end

node_operator(("Operator"))
node_webhook_service["Webhook service"]

node_operator -->|"starts run"| node_runner
node_runner -->|"fetches data"| node_provider
node_provider -->|"requests data"| node_market_api
node_runner -->|"submits inputs"| node_ensemble
node_ensemble -->|"computes features"| node_features
node_ensemble -->|"builds suggestions"| node_suggestions
node_runner -->|"dispatches signal"| node_dispatcher
node_dispatcher -->|"sends signal"| node_terminal
node_dispatcher -->|"sends signal"| node_supabase_adapter
node_supabase_adapter -->|"writes signals"| node_signals_table
node_dispatcher -->|"sends signal"| node_webhook_adapter
node_webhook_adapter -->|"posts signal"| node_webhook_service

click node_runner "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/main.py"
click node_provider "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/data_provider.py"
click node_features "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/features.py"
click node_ensemble "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/model.py"
click node_suggestions "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/suggestions.py"
click node_dispatcher "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/notifier.py"
click node_terminal "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/notifier.py"
click node_supabase_adapter "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/notifier.py"
click node_signals_table "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/schema.sql"
click node_webhook_adapter "https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/notifier.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_runner toneBlue
class node_provider,node_market_api toneAmber
class node_features,node_ensemble,node_suggestions,node_webhook_service toneMint
class node_dispatcher,node_terminal,node_supabase_adapter,node_signals_table,node_webhook_adapter toneRose
class node_operator toneIndigo
```

## Components

### Run orchestration

- [Run coordinator](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/main.py): `dual_agent_trader/main.py`

### Market data

- [Data providers](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/data_provider.py): `dual_agent_trader/data_provider.py`
- **Alpha Vantage**

### Signal analysis

- [Feature engineering](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/features.py): `dual_agent_trader/features.py`
- [Dual-agent ensemble](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/model.py): `dual_agent_trader/model.py`
- [Risk suggestions](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/suggestions.py): `dual_agent_trader/suggestions.py`

### Signal delivery

- [Channel dispatcher](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/notifier.py): `dual_agent_trader/notifier.py`
- [Terminal output](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/notifier.py): `dual_agent_trader/notifier.py`
- [Supabase adapter](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/notifier.py): `dual_agent_trader/notifier.py`
- [Signals table](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/schema.sql): `dual_agent_trader/schema.sql`
- [Webhook adapter](https://github.com/ghanashyam06/marl/blob/main/dual_agent_trader/notifier.py): `dual_agent_trader/notifier.py`

### Other components

- **Operator**
- **Webhook service**

## Connections

- Operator → Run coordinator: starts run (evidence: `README.md`)
- Run coordinator → Data providers: fetches data (evidence: `dual_agent_trader/main.py`)
- Data providers → Alpha Vantage: requests data (evidence: `dual_agent_trader/data_provider.py`)
- Run coordinator → Dual-agent ensemble: submits inputs (evidence: `dual_agent_trader/main.py`)
- Dual-agent ensemble → Feature engineering: computes features (evidence: `dual_agent_trader/model.py`)
- Dual-agent ensemble → Risk suggestions: builds suggestions (evidence: `dual_agent_trader/model.py`)
- Run coordinator → Channel dispatcher: dispatches signal (evidence: `dual_agent_trader/main.py`)
- Channel dispatcher → Terminal output: sends signal (evidence: `dual_agent_trader/notifier.py`)
- Channel dispatcher → Supabase adapter: sends signal (evidence: `dual_agent_trader/notifier.py`)
- Supabase adapter → Signals table: writes signals (evidence: `README.md`)
- Channel dispatcher → Webhook adapter: sends signal (evidence: `dual_agent_trader/notifier.py`)
- Webhook adapter → Webhook service: posts signal (evidence: `dual_agent_trader/notifier.py`)
