# chaostrader913/apps architecture

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

- Interactive diagram: https://gitdiagram.com/chaostrader913/apps
- Repository: https://github.com/chaostrader913/apps

## Overview

This repository implements a Hong Kong stock signal daily-report workflow. The main entry point fetches constituent-stock data, obtains a Hang Seng benchmark, scans technical signals, calculates relative-strength rankings and history, plots hit stocks, and writes a self-contained HTML report. Data acquisition supports Yahoo and Tencent sources, with incremental CSV caching. The README contains no architectural detail; relationships below rely on sampled source and SOURCE INDEX references, so unsampled scheduling behavior is not represented.

Main entry points: [`quant-reporter/main.py`](https://github.com/chaostrader913/apps/blob/main/quant-reporter/main.py) (Daily Pipeline), [`quant-reporter/fetch_data.py`](https://github.com/chaostrader913/apps/blob/main/quant-reporter/fetch_data.py) (Stock Data Fetch), [`quant-reporter/data_cache.py`](https://github.com/chaostrader913/apps/blob/main/quant-reporter/data_cache.py) (Daily CSV Cache), [`quant-reporter/report.py`](https://github.com/chaostrader913/apps/blob/main/quant-reporter/report.py) (HTML Report Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Workflow"]
  node_main["Daily Pipeline<br/>[main.py]"]
  node_config["Stock &amp; Signal Config<br/>[config.py]"]
end

subgraph group_market_data["Market Data"]
  node_fetch_all["Stock Data Fetch<br/>[fetch_data.py]"]
  node_yahoo["Yahoo Finance"]
  node_tencent["Tencent Finance"]
  node_cache[("Daily CSV Cache<br/>[data_cache.py]")]
  node_stock_data["Stock OHLCV Data"]
  node_benchmark["Hang Seng Benchmark"]
end

subgraph group_analysis["Signal Analysis"]
  node_signal_scan["Technical Signal Scan<br/>[scan_signals.py]"]
  node_rs_analysis["Relative Strength Ranking"]
end

subgraph group_presentation["Report Output"]
  node_charting["Signal Stock Charts<br/>[plot_charts.py]"]
  node_chart_files["Chart Images"]
  node_html_report["HTML Report Builder<br/>[report.py]"]
  node_report_file["Daily HTML Report"]
end

node_runner(("Report Run"))
node_report_reader(("Report Recipient"))

node_runner -->|"starts"| node_main
node_main -->|"fetches stocks"| node_fetch_all
node_main -->|"gets benchmark"| node_cache
node_main -->|"scans signals"| node_signal_scan
node_main -->|"computes rankings"| node_rs_analysis
node_main -->|"plots hits"| node_charting
node_main -->|"saves report"| node_html_report
node_fetch_all -->|"reads pool"| node_config
node_fetch_all -->|"downloads data"| node_yahoo
node_fetch_all -->|"falls back"| node_tencent
node_fetch_all -->|"returns OHLCV"| node_stock_data
node_cache -->|"fetches increments"| node_yahoo
node_cache -->|"fetches index"| node_tencent
node_cache -->|"falls back"| node_fetch_all
node_cache -->|"reads and writes"| node_stock_data
node_main -->|"passes data"| node_stock_data
node_main -->|"passes benchmark"| node_benchmark
node_rs_analysis -->|"loads benchmark"| node_cache
node_signal_scan -->|"reads thresholds"| node_config
node_charting -->|"uses indicators"| node_signal_scan
node_charting -->|"writes images"| node_chart_files
node_html_report -->|"reads report settings"| node_config
node_html_report -->|"embeds images"| node_chart_files
node_html_report -->|"writes HTML"| node_report_file
node_report_reader -->|"views"| node_report_file

click node_main "https://github.com/chaostrader913/apps/blob/main/quant-reporter/main.py"
click node_config "https://github.com/chaostrader913/apps/blob/main/quant-reporter/config.py"
click node_fetch_all "https://github.com/chaostrader913/apps/blob/main/quant-reporter/fetch_data.py"
click node_cache "https://github.com/chaostrader913/apps/blob/main/quant-reporter/data_cache.py"
click node_signal_scan "https://github.com/chaostrader913/apps/blob/main/quant-reporter/scan_signals.py"
click node_rs_analysis "https://github.com/chaostrader913/apps/blob/main/quant-reporter/relative_strength.py"
click node_charting "https://github.com/chaostrader913/apps/blob/main/quant-reporter/plot_charts.py"
click node_html_report "https://github.com/chaostrader913/apps/blob/main/quant-reporter/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_main,node_config toneBlue
class node_fetch_all,node_yahoo,node_tencent,node_cache,node_stock_data,node_benchmark toneAmber
class node_signal_scan,node_rs_analysis toneMint
class node_charting,node_chart_files,node_html_report,node_report_file toneRose
class node_runner,node_report_reader toneIndigo
```

## Components

### Workflow

- [Daily Pipeline](https://github.com/chaostrader913/apps/blob/main/quant-reporter/main.py): `quant-reporter/main.py`
- [Stock & Signal Config](https://github.com/chaostrader913/apps/blob/main/quant-reporter/config.py): `quant-reporter/config.py`

### Market Data

- [Stock Data Fetch](https://github.com/chaostrader913/apps/blob/main/quant-reporter/fetch_data.py): `quant-reporter/fetch_data.py`
- **Yahoo Finance**
- **Tencent Finance**
- [Daily CSV Cache](https://github.com/chaostrader913/apps/blob/main/quant-reporter/data_cache.py): `quant-reporter/data_cache.py`
- **Stock OHLCV Data**
- **Hang Seng Benchmark**

### Signal Analysis

- [Technical Signal Scan](https://github.com/chaostrader913/apps/blob/main/quant-reporter/scan_signals.py): `quant-reporter/scan_signals.py`
- [Relative Strength Ranking](https://github.com/chaostrader913/apps/blob/main/quant-reporter/relative_strength.py): `quant-reporter/relative_strength.py`

### Report Output

- [Signal Stock Charts](https://github.com/chaostrader913/apps/blob/main/quant-reporter/plot_charts.py): `quant-reporter/plot_charts.py`
- **Chart Images**
- [HTML Report Builder](https://github.com/chaostrader913/apps/blob/main/quant-reporter/report.py): `quant-reporter/report.py`
- **Daily HTML Report**

### Other components

- **Report Run**
- **Report Recipient**

## Connections

- Report Run → Daily Pipeline: starts
- Daily Pipeline → Stock Data Fetch: fetches stocks (evidence: `quant-reporter/main.py`)
- Daily Pipeline → Daily CSV Cache: gets benchmark (evidence: `quant-reporter/main.py`)
- Daily Pipeline → Technical Signal Scan: scans signals (evidence: `quant-reporter/main.py`)
- Daily Pipeline → Relative Strength Ranking: computes rankings (evidence: `quant-reporter/main.py`)
- Daily Pipeline → Signal Stock Charts: plots hits (evidence: `quant-reporter/main.py`)
- Daily Pipeline → HTML Report Builder: saves report (evidence: `quant-reporter/main.py`)
- Stock Data Fetch → Stock & Signal Config: reads pool (evidence: `quant-reporter/fetch_data.py`)
- Stock Data Fetch → Yahoo Finance: downloads data (evidence: `quant-reporter/fetch_data.py`)
- Stock Data Fetch → Tencent Finance: falls back (evidence: `quant-reporter/fetch_data.py`)
- Stock Data Fetch → Stock OHLCV Data: returns OHLCV (evidence: `quant-reporter/fetch_data.py`)
- Daily CSV Cache → Yahoo Finance: fetches increments (evidence: `quant-reporter/data_cache.py`)
- Daily CSV Cache → Tencent Finance: fetches index (evidence: `quant-reporter/data_cache.py`)
- Daily CSV Cache → Stock Data Fetch: falls back (evidence: `quant-reporter/data_cache.py`)
- Daily CSV Cache → Stock OHLCV Data: reads and writes (evidence: `quant-reporter/data_cache.py`)
- Daily Pipeline → Stock OHLCV Data: passes data (evidence: `quant-reporter/main.py`)
- Daily Pipeline → Hang Seng Benchmark: passes benchmark (evidence: `quant-reporter/main.py`)
- Relative Strength Ranking → Daily CSV Cache: loads benchmark (evidence: `quant-reporter/relative_strength.py`)
- Technical Signal Scan → Stock & Signal Config: reads thresholds (evidence: `quant-reporter/scan_signals.py`)
- Signal Stock Charts → Technical Signal Scan: uses indicators (evidence: `quant-reporter/plot_charts.py`)
- Signal Stock Charts → Chart Images: writes images (evidence: `quant-reporter/plot_charts.py`)
- HTML Report Builder → Stock & Signal Config: reads report settings (evidence: `quant-reporter/report.py`)
- HTML Report Builder → Chart Images: embeds images (evidence: `quant-reporter/report.py`)
- HTML Report Builder → Daily HTML Report: writes HTML (evidence: `quant-reporter/report.py`)
- Report Recipient → Daily HTML Report: views
