# faizanmasroor/stock-grapher architecture

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

- Interactive diagram: https://gitdiagram.com/faizanmasroor/stock-grapher
- Repository: https://github.com/faizanmasroor/stock-grapher

## Overview

This is a single-script command-line tool for generating and saving historical stock high-price graphs. The user supplies a ticker; the script fetches daily and intraday history, cleans and filters it to the latest trading month and day, derives decimal-hour values, then displays and saves two plots. All runtime stages are implemented in one file. The edges reflect calls visible in the excerpt; market-data access and plotting are external dependencies.

Main entry points: [`stock_grapher.py`](https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Stock graph workflow"]
  node_entry["CLI entry<br/>[stock_grapher.py]"]
  node_market["Market history<br/>[stock_grapher.py]"]
  node_cleanup["Data cleanup<br/>[stock_grapher.py]"]
  node_filter["Trading-day filter<br/>[stock_grapher.py]"]
  node_intraday["Decimal-hour derivation<br/>[stock_grapher.py]"]
  node_monthly["Monthly graph<br/>[stock_grapher.py]"]
  node_daily["Daily graph<br/>[stock_grapher.py]"]
end

node_user(("User"))
node_yfinance["Yahoo Finance"]
node_plots["Matplotlib / Seaborn"]

node_user -->|"enters ticker"| node_entry
node_entry -->|"requests history"| node_market
node_market -->|"fetches history"| node_yfinance
node_entry -->|"cleans frames"| node_cleanup
node_entry -->|"filters frames"| node_filter
node_entry -->|"derives decimal hour"| node_intraday
node_entry -->|"plots monthly data"| node_monthly
node_entry -->|"plots daily data"| node_daily
node_monthly -->|"renders and saves"| node_plots
node_daily -->|"renders and saves"| node_plots

click node_entry "https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py"
click node_market "https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py"
click node_cleanup "https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py"
click node_filter "https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py"
click node_intraday "https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py"
click node_monthly "https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py"
click node_daily "https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.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_entry,node_market,node_cleanup,node_filter,node_intraday,node_monthly,node_daily,node_user toneBlue
class node_yfinance,node_plots toneIndigo
```

## Components

### Stock graph workflow

- [CLI entry](https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py): `stock_grapher.py`
- [Market history](https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py): `stock_grapher.py`
- [Data cleanup](https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py): `stock_grapher.py`
- [Trading-day filter](https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py): `stock_grapher.py`
- [Decimal-hour derivation](https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py): `stock_grapher.py`
- [Monthly graph](https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py): `stock_grapher.py`
- [Daily graph](https://github.com/faizanmasroor/stock-grapher/blob/main/stock_grapher.py): `stock_grapher.py`

### Other components

- **User**
- **Yahoo Finance**
- **Matplotlib / Seaborn**

## Connections

- User → CLI entry: enters ticker (evidence: `stock_grapher.py`)
- CLI entry → Market history: requests history (evidence: `stock_grapher.py`)
- Market history → Yahoo Finance: fetches history (evidence: `stock_grapher.py`)
- CLI entry → Data cleanup: cleans frames (evidence: `stock_grapher.py`)
- CLI entry → Trading-day filter: filters frames (evidence: `stock_grapher.py`)
- CLI entry → Decimal-hour derivation: derives decimal hour (evidence: `stock_grapher.py`)
- CLI entry → Monthly graph: plots monthly data (evidence: `stock_grapher.py`)
- CLI entry → Daily graph: plots daily data (evidence: `stock_grapher.py`)
- Monthly graph → Matplotlib / Seaborn: renders and saves (evidence: `stock_grapher.py`)
- Daily graph → Matplotlib / Seaborn: renders and saves (evidence: `stock_grapher.py`)
