# diegopp25/generalforecast architecture

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

- Interactive diagram: https://gitdiagram.com/diegopp25/generalforecast
- Repository: https://github.com/diegopp25/generalforecast

## Overview

Stock Board es una aplicación FastAPI monolítica: el navegador usa el panel para buscar y gestionar acciones, y consultar datos de mercado. CNN se consulta primero mediante su API desde Chromium y, si falla, mediante una página renderizada por Playwright; ambos resultados se normalizan en el parser. La selección se persiste en stocks.json y los datos consultados se mantienen en caché durante diez minutos. La interfaz y la búsqueda Yahoo están documentadas, pero sus detalles de implementación no se muestrearon; las conexiones se apoyan en el README.

Main entry points: [`app/main.py`](https://github.com/diegopp25/generalforecast/blob/main/app/main.py) (FastAPI), [`static/index.html`](https://github.com/diegopp25/generalforecast/blob/main/static/index.html) (Panel de acciones), [`app/fetcher.py`](https://github.com/diegopp25/generalforecast/blob/main/app/fetcher.py) (Consulta API CNN), [`app/parser.py`](https://github.com/diegopp25/generalforecast/blob/main/app/parser.py) (Normalización de datos)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Panel web"]
  node_panel["Panel de acciones<br/>[index.html]"]
end

subgraph group_api["API y flujo"]
  node_server["FastAPI<br/>[main.py]"]
  node_search["Búsqueda Yahoo<br/>[main.py]"]
end

subgraph group_market["Datos de mercado"]
  node_cnnapi["Consulta API CNN<br/>[fetcher.py]"]
  node_fallback["Render CNN<br/>[fetcher.py]"]
  node_parser["Normalización de datos<br/>[parser.py]"]
end

subgraph group_state["Estado local"]
  node_stocks[("Selección persistida<br/>[stocks.json]")]
  node_cache[("Caché temporal<br/>[main.py]")]
end

node_browser(("Navegador"))
node_yahoo["Yahoo Finance"]
node_cnn["CNN Markets"]

node_browser -->|"abre panel"| node_panel
node_panel -->|"usa API"| node_server
node_server -->|"sirve interfaz"| node_panel
node_server -->|"atiende búsqueda"| node_search
node_search -->|"busca tickers"| node_yahoo
node_server -->|"lee y guarda"| node_stocks
node_server -->|"consulta y actualiza"| node_cache
node_server -->|"solicita datos"| node_cnnapi
node_cnnapi -->|"consulta API"| node_cnn
node_server -->|"usa si falla API"| node_fallback
node_fallback -->|"renderiza página"| node_cnn
node_server -->|"normaliza respuesta"| node_parser

click node_panel "https://github.com/diegopp25/generalforecast/blob/main/static/index.html"
click node_server "https://github.com/diegopp25/generalforecast/blob/main/app/main.py"
click node_search "https://github.com/diegopp25/generalforecast/blob/main/app/main.py"
click node_cnnapi "https://github.com/diegopp25/generalforecast/blob/main/app/fetcher.py"
click node_fallback "https://github.com/diegopp25/generalforecast/blob/main/app/fetcher.py"
click node_parser "https://github.com/diegopp25/generalforecast/blob/main/app/parser.py"
click node_stocks "https://github.com/diegopp25/generalforecast/blob/main/stocks.json"
click node_cache "https://github.com/diegopp25/generalforecast/blob/main/app/main.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_panel toneBlue
class node_server,node_search toneAmber
class node_cnnapi,node_fallback,node_parser toneMint
class node_stocks,node_cache toneRose
class node_browser,node_yahoo,node_cnn toneIndigo
```

## Components

### Panel web

- [Panel de acciones](https://github.com/diegopp25/generalforecast/blob/main/static/index.html): `static/index.html`

### API y flujo

- [FastAPI](https://github.com/diegopp25/generalforecast/blob/main/app/main.py): `app/main.py`
- [Búsqueda Yahoo](https://github.com/diegopp25/generalforecast/blob/main/app/main.py): `app/main.py`

### Datos de mercado

- [Consulta API CNN](https://github.com/diegopp25/generalforecast/blob/main/app/fetcher.py): `app/fetcher.py`
- [Render CNN](https://github.com/diegopp25/generalforecast/blob/main/app/fetcher.py): `app/fetcher.py`
- [Normalización de datos](https://github.com/diegopp25/generalforecast/blob/main/app/parser.py): `app/parser.py`

### Estado local

- [Selección persistida](https://github.com/diegopp25/generalforecast/blob/main/stocks.json): `stocks.json`
- [Caché temporal](https://github.com/diegopp25/generalforecast/blob/main/app/main.py): `app/main.py`

### Other components

- **Navegador**
- **Yahoo Finance**
- **CNN Markets**

## Connections

- Navegador → Panel de acciones: abre panel (evidence: `README.md`)
- Panel de acciones → FastAPI: usa API (evidence: `README.md`)
- FastAPI → Panel de acciones: sirve interfaz (evidence: `README.md`)
- FastAPI → Búsqueda Yahoo: atiende búsqueda (evidence: `app/main.py`)
- Búsqueda Yahoo → Yahoo Finance: busca tickers (evidence: `app/main.py`)
- FastAPI → Selección persistida: lee y guarda (evidence: `app/main.py`)
- FastAPI → Caché temporal: consulta y actualiza (evidence: `app/main.py`)
- FastAPI → Consulta API CNN: solicita datos (evidence: `app/main.py`)
- Consulta API CNN → CNN Markets: consulta API (evidence: `app/fetcher.py`)
- FastAPI → Render CNN: usa si falla API (evidence: `app/main.py`)
- Render CNN → CNN Markets: renderiza página (evidence: `app/fetcher.py`)
- FastAPI → Normalización de datos: normaliza respuesta (evidence: `app/main.py`)
