# skyte/relative-strength architecture

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

- Interactive diagram: https://gitdiagram.com/skyte/relative-strength
- Repository: https://github.com/skyte/relative-strength

## Overview

This repository generates IBD-style relative-strength percentile rankings for stocks and industries. The main workflow is to gather a configured ticker universe, fetch price histories, calculate benchmark-relative performance and percentiles, then write CSV reports. The command-line entry point runs data collection before ranking; the data and ranking scripts can also be run separately. Yahoo Finance and TD Ameritrade are documented price sources. The graph reflects the shown calls and documented capabilities; unsampled implementation details are not inferred.

Main entry points: [`rs_data.py`](https://github.com/skyte/relative-strength/blob/main/rs_data.py) (Price Collection), [`rs_ranking.py`](https://github.com/skyte/relative-strength/blob/main/rs_ranking.py) (Stock Ranking), [`relative-strength.py`](https://github.com/skyte/relative-strength/blob/main/relative-strength.py) (CLI Workflow), [`data_persist/ticker_info.json`](https://github.com/skyte/relative-strength/blob/main/data_persist/ticker_info.json) (Ticker Metadata)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Universe &amp; Data"]
  node_universe["Ticker Universe<br/>[rs_data.py]"]
  node_data["Price Collection<br/>[rs_data.py]"]
  node_prices[("Price History<br/>[rs_data.py]")]
  node_tickerinfo[("Ticker Metadata<br/>[ticker_info.json]")]
end

subgraph group_ranking["Ranking &amp; Reports"]
  node_ranking["Stock Ranking<br/>[rs_ranking.py]"]
  node_industry["Industry Ranking<br/>[rs_ranking.py]"]
  node_reports["CSV Reports<br/>[rs_ranking.py]"]
end

subgraph group_runtime["Runtime"]
  node_entry["CLI Workflow"]
  node_config["Configuration<br/>[config.yaml]"]
end

node_user(("User"))
node_nasdaq["Nasdaq / Wiki Listings"]
node_yahoo["Yahoo Finance"]
node_tda["TD Ameritrade"]

node_user -->|"runs"| node_entry
node_entry -->|"starts collection"| node_data
node_entry -->|"starts ranking"| node_ranking
node_config -->|"configures"| node_data
node_universe -->|"fetches listings"| node_nasdaq
node_data -->|"downloads prices"| node_yahoo
node_data -->|"requests price history"| node_tda
node_data -->|"writes"| node_prices
node_data -->|"writes"| node_tickerinfo
node_ranking -->|"reads"| node_prices
node_ranking -->|"reads"| node_tickerinfo
node_ranking -->|"aggregates industries"| node_industry
node_ranking -->|"writes CSVs"| node_reports

click node_entry "https://github.com/skyte/relative-strength/blob/main/relative-strength.py"
click node_config "https://github.com/skyte/relative-strength/blob/main/config.yaml"
click node_universe "https://github.com/skyte/relative-strength/blob/main/rs_data.py"
click node_data "https://github.com/skyte/relative-strength/blob/main/rs_data.py"
click node_prices "https://github.com/skyte/relative-strength/blob/main/rs_data.py"
click node_tickerinfo "https://github.com/skyte/relative-strength/blob/main/data_persist/ticker_info.json"
click node_ranking "https://github.com/skyte/relative-strength/blob/main/rs_ranking.py"
click node_industry "https://github.com/skyte/relative-strength/blob/main/rs_ranking.py"
click node_reports "https://github.com/skyte/relative-strength/blob/main/rs_ranking.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_universe,node_data,node_prices,node_tickerinfo,node_user toneBlue
class node_ranking,node_industry,node_reports toneAmber
class node_entry,node_config toneMint
class node_nasdaq,node_yahoo,node_tda toneIndigo
```

## Components

### Universe & Data

- [Ticker Universe](https://github.com/skyte/relative-strength/blob/main/rs_data.py): `rs_data.py`
- [Price Collection](https://github.com/skyte/relative-strength/blob/main/rs_data.py): `rs_data.py`
- [Price History](https://github.com/skyte/relative-strength/blob/main/rs_data.py): `rs_data.py`
- [Ticker Metadata](https://github.com/skyte/relative-strength/blob/main/data_persist/ticker_info.json): `data_persist/ticker_info.json`

### Ranking & Reports

- [Stock Ranking](https://github.com/skyte/relative-strength/blob/main/rs_ranking.py): `rs_ranking.py`
- [Industry Ranking](https://github.com/skyte/relative-strength/blob/main/rs_ranking.py): `rs_ranking.py`
- [CSV Reports](https://github.com/skyte/relative-strength/blob/main/rs_ranking.py): `rs_ranking.py`

### Runtime

- [CLI Workflow](https://github.com/skyte/relative-strength/blob/main/relative-strength.py): `relative-strength.py`
- [Configuration](https://github.com/skyte/relative-strength/blob/main/config.yaml): `config.yaml`

### Other components

- **User**
- **Nasdaq / Wiki Listings**
- **Yahoo Finance**
- **TD Ameritrade**

## Connections

- User → CLI Workflow: runs (evidence: `README.md`)
- CLI Workflow → Price Collection: starts collection (evidence: `relative-strength.py`)
- CLI Workflow → Stock Ranking: starts ranking (evidence: `relative-strength.py`)
- Configuration → Price Collection: configures (evidence: `rs_data.py`)
- Ticker Universe → Nasdaq / Wiki Listings: fetches listings (evidence: `rs_data.py`)
- Price Collection → Yahoo Finance: downloads prices (evidence: `rs_data.py`)
- Price Collection → TD Ameritrade: requests price history (evidence: `rs_data.py`)
- Price Collection → Price History: writes (evidence: `rs_data.py`)
- Price Collection → Ticker Metadata: writes (evidence: `rs_data.py`)
- Stock Ranking → Price History: reads (evidence: `rs_ranking.py`)
- Stock Ranking → Ticker Metadata: reads (evidence: `rs_ranking.py`)
- Stock Ranking → Industry Ranking: aggregates industries (evidence: `rs_ranking.py`)
- Stock Ranking → CSV Reports: writes CSVs (evidence: `rs_ranking.py`)
