# incid1/stock-viewer-fetch-from-yahoofinance-api architecture

> Architecture diagram of the GitHub repository incid1/stock-viewer-fetch-from-yahoofinance-api, 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/incid1/stock-viewer-fetch-from-yahoofinance-api
- Repository: https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api

## Overview

Stock & ETF Analyzer serves a browser UI and an API for symbol-based market analysis. The main API workflow is: a user requests a symbol, Express checks its in-memory cache, and on a miss launches the Python analyzer; that script fetches Yahoo Finance history and metadata, computes indicators and recommendations, and returns JSON for caching and the response. The README also documents the Python helper as a direct-use capability. The frontend file contents were not sampled, so its internal behavior and API calls are not asserted.

Main entry points: [`backend/fetch_stock.py`](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/fetch_stock.py) (Yahoo Finance fetch), [`backend/server.js`](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/server.js) (Express API and routes), [`frontend/index.html`](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/frontend/index.html) (Web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP service"]
  node_api_server["Express API and routes<br/>[server.js]"]
  node_cache[("Quote cache<br/>[server.js]")]
  node_python_runner["Python process runner<br/>[server.js]"]
end

subgraph group_analysis["Market analysis"]
  node_data_fetch["Yahoo Finance fetch<br/>[fetch_stock.py]"]
  node_indicators["Technical indicators<br/>[fetch_stock.py]"]
  node_recommendations["Recommendations<br/>[fetch_stock.py]"]
end

subgraph group_client["Browser interface"]
  node_browser_ui["Web interface<br/>[index.html]"]
end

node_user(("Market explorer"))
node_yahoo{{"Yahoo Finance"}}
node_python_user(("Direct script user"))

node_user -->|"requests symbol"| node_api_server
node_api_server -->|"checks and stores"| node_cache
node_api_server -->|"runs on cache miss"| node_python_runner
node_python_runner -->|"executes script"| node_data_fetch
node_data_fetch -->|"fetches history and info"| node_yahoo
node_data_fetch -->|"computes indicators"| node_indicators
node_data_fetch -->|"derives recommendation"| node_recommendations
node_api_server -->|"returns JSON"| node_user
node_user -->|"uses interface"| node_browser_ui
node_python_user -->|"runs symbol analysis"| node_data_fetch

click node_api_server "https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/server.js"
click node_cache "https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/server.js"
click node_python_runner "https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/server.js"
click node_data_fetch "https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/fetch_stock.py"
click node_indicators "https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/fetch_stock.py"
click node_recommendations "https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/fetch_stock.py"
click node_browser_ui "https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/frontend/index.html"

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_api_server,node_cache,node_python_runner,node_python_user toneBlue
class node_data_fetch,node_indicators,node_recommendations toneAmber
class node_browser_ui toneMint
class node_user,node_yahoo toneIndigo
```

## Components

### HTTP service

- [Express API and routes](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/server.js): `backend/server.js`
- [Quote cache](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/server.js): `backend/server.js`
- [Python process runner](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/server.js): `backend/server.js`

### Market analysis

- [Yahoo Finance fetch](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/fetch_stock.py): `backend/fetch_stock.py`
- [Technical indicators](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/fetch_stock.py): `backend/fetch_stock.py`
- [Recommendations](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/backend/fetch_stock.py): `backend/fetch_stock.py`

### Browser interface

- [Web interface](https://github.com/incid1/stock-viewer-fetch-from-yahoofinance-api/blob/main/frontend/index.html): `frontend/index.html`

### Other components

- **Market explorer**
- **Yahoo Finance**
- **Direct script user**

## Connections

- Market explorer → Express API and routes: requests symbol (evidence: `README.md`)
- Express API and routes → Quote cache: checks and stores (evidence: `backend/server.js`)
- Express API and routes → Python process runner: runs on cache miss (evidence: `backend/server.js`)
- Python process runner → Yahoo Finance fetch: executes script (evidence: `backend/server.js`)
- Yahoo Finance fetch → Yahoo Finance: fetches history and info (evidence: `backend/fetch_stock.py`)
- Yahoo Finance fetch → Technical indicators: computes indicators (evidence: `backend/fetch_stock.py`)
- Yahoo Finance fetch → Recommendations: derives recommendation (evidence: `backend/fetch_stock.py`)
- Express API and routes → Market explorer: returns JSON (evidence: `backend/server.js`)
- Market explorer → Web interface: uses interface (evidence: `README.md`)
- Direct script user → Yahoo Finance fetch: runs symbol analysis (evidence: `README.md`)
