# bharathcherala193/trading_macro_economics_agent architecture

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

- Interactive diagram: https://gitdiagram.com/bharathcherala193/trading_macro_economics_agent
- Repository: https://github.com/bharathcherala193/trading_macro_economics_agent

## Overview

This repository is a macro-event strategy-selection pipeline. Its main workflow collects calendar events and macro news, generates or uses trade logs and prices, builds weekly features, evaluates strategy permutations with walk-forward validation, and produces an outlook, charts, and a performance report. The README documents the overall stages; sampled source confirms key storage and modeling calls. Some subsystem links rely on README documentation because their implementation was not fully sampled.

Main entry points: [`run_all.py`](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/run_all.py) (Pipeline runner), [`config.py`](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/config.py) (Pipeline configuration), [`walkforward.py`](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/walkforward.py) (Walk-forward selection), [`store.py`](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/store.py) (Event and news store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Data collection"]
  node_calendar["Calendar ingestion<br/>[ingest_apify.py]"]
  node_news["News ingestion<br/>[ingest_news.py]"]
  node_prices["Market prices<br/>[trades.py]"]
  node_store[("Event and news store<br/>[store.py]")]
end

subgraph group_analysis["Strategy analysis"]
  node_trades["Trade generation<br/>[trades.py]"]
  node_features["Weekly feature engineering<br/>[features.py]"]
  node_validation["Walk-forward selection<br/>[walkforward.py]"]
end

subgraph group_insight["Research outputs"]
  node_charts["Sentiment charts<br/>[charts.py]"]
  node_outlook["Macro outlook<br/>[macro_summary.py]"]
  node_report["Performance report<br/>[report.py]"]
end

subgraph group_runtime["Pipeline runtime"]
  node_runner["Pipeline runner<br/>[run_all.py]"]
  node_config["Pipeline configuration<br/>[config.py]"]
end

node_user(("Analyst"))
node_apify{{"Apify calendar"}}
node_tavily{{"Tavily news search"}}
node_yfinance{{"Yahoo Finance"}}

node_user -->|"runs pipeline"| node_runner
node_runner -->|"runs ingestion"| node_calendar
node_runner -->|"runs ingestion"| node_news
node_runner -->|"runs generation"| node_trades
node_runner -->|"runs validation"| node_validation
node_runner -->|"runs charts"| node_charts
node_runner -->|"runs summary"| node_outlook
node_runner -->|"runs report"| node_report
node_calendar -->|"fetches events"| node_apify
node_news -->|"searches news"| node_tavily
node_prices -->|"downloads prices"| node_yfinance
node_calendar -->|"upserts events"| node_store
node_news -->|"upserts articles"| node_store
node_trades -->|"loads price history"| node_prices
node_store -->|"provides event and news data"| node_validation
node_trades -->|"provides trade log"| node_validation
node_features -->|"builds model features"| node_validation
node_store -->|"provides event and news data"| node_charts
node_store -->|"provides event and news data"| node_outlook
node_validation -->|"provides validation results"| node_report
node_config -->|"configures ingestion"| node_calendar
node_config -->|"configures searches"| node_news
node_config -->|"configures backtest"| node_trades
node_config -->|"configures features"| node_features
node_config -->|"configures validation"| node_validation
node_config -->|"configures report"| node_report

click node_runner "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/run_all.py"
click node_config "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/config.py"
click node_calendar "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/ingest_apify.py"
click node_news "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/ingest_news.py"
click node_prices "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/trades.py"
click node_trades "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/trades.py"
click node_store "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/store.py"
click node_features "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/features.py"
click node_validation "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/walkforward.py"
click node_charts "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/charts.py"
click node_outlook "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/macro_summary.py"
click node_report "https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/report.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_calendar,node_news,node_prices,node_store toneBlue
class node_trades,node_features,node_validation toneAmber
class node_charts,node_outlook,node_report,node_apify toneMint
class node_runner,node_config toneRose
class node_user,node_tavily,node_yfinance toneIndigo
```

## Components

### Data collection

- [Calendar ingestion](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/ingest_apify.py): `ingest_apify.py`
- [News ingestion](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/ingest_news.py): `ingest_news.py`
- [Market prices](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/trades.py): `trades.py`
- [Event and news store](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/store.py): `store.py`

### Strategy analysis

- [Trade generation](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/trades.py): `trades.py`
- [Weekly feature engineering](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/features.py): `features.py`
- [Walk-forward selection](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/walkforward.py): `walkforward.py`

### Research outputs

- [Sentiment charts](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/charts.py): `charts.py`
- [Macro outlook](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/macro_summary.py): `macro_summary.py`
- [Performance report](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/report.py): `report.py`

### Pipeline runtime

- [Pipeline runner](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/run_all.py): `run_all.py`
- [Pipeline configuration](https://github.com/bharathcherala193/trading_macro_economics_agent/blob/master/config.py): `config.py`

### Other components

- **Analyst**
- **Apify calendar**
- **Tavily news search**
- **Yahoo Finance**

## Connections

- Analyst → Pipeline runner: runs pipeline (evidence: `README.md`)
- Pipeline runner → Calendar ingestion: runs ingestion (evidence: `run_all.py`)
- Pipeline runner → News ingestion: runs ingestion (evidence: `run_all.py`)
- Pipeline runner → Trade generation: runs generation (evidence: `run_all.py`)
- Pipeline runner → Walk-forward selection: runs validation (evidence: `run_all.py`)
- Pipeline runner → Sentiment charts: runs charts (evidence: `run_all.py`)
- Pipeline runner → Macro outlook: runs summary (evidence: `run_all.py`)
- Pipeline runner → Performance report: runs report (evidence: `run_all.py`)
- Calendar ingestion → Apify calendar: fetches events (evidence: `README.md`)
- News ingestion → Tavily news search: searches news (evidence: `README.md`)
- Market prices → Yahoo Finance: downloads prices (evidence: `trades.py`)
- Calendar ingestion → Event and news store: upserts events (evidence: `ingest_apify.py`)
- News ingestion → Event and news store: upserts articles (evidence: `ingest_news.py`)
- Trade generation → Market prices: loads price history (evidence: `trades.py`)
- Event and news store → Walk-forward selection: provides event and news data (evidence: `walkforward.py`)
- Trade generation → Walk-forward selection: provides trade log (evidence: `README.md`)
- Weekly feature engineering → Walk-forward selection: builds model features (evidence: `walkforward.py`)
- Event and news store → Sentiment charts: provides event and news data (evidence: `charts.py`)
- Event and news store → Macro outlook: provides event and news data (evidence: `macro_summary.py`)
- Walk-forward selection → Performance report: provides validation results (evidence: `report.py`)
- Pipeline configuration → Calendar ingestion: configures ingestion (evidence: `ingest_apify.py`)
- Pipeline configuration → News ingestion: configures searches (evidence: `ingest_news.py`)
- Pipeline configuration → Trade generation: configures backtest (evidence: `trades.py`)
- Pipeline configuration → Weekly feature engineering: configures features (evidence: `features.py`)
- Pipeline configuration → Walk-forward selection: configures validation (evidence: `walkforward.py`)
- Pipeline configuration → Performance report: configures report (evidence: `report.py`)
