# moneeshreddych/stockprizepredictor architecture

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

- Interactive diagram: https://gitdiagram.com/moneeshreddych/stockprizepredictor
- Repository: https://github.com/moneeshreddych/stockprizepredictor

## Overview

BullInsights collects market prices and financial news, stores them in Supabase, then serves market history, news, and ML forecasts to a browser dashboard. The documented ML workflow combines FinBERT sentiment scoring with historical-price features and Temporal Fusion Transformer forecasts; the sampled pipeline confirms sentiment and forecast persistence, but its omitted sections limit certainty about intermediate calls. Separate live-price collection and historical-price collection are visible in the source. The graph omits deployment and build machinery.

Main entry points: [`frontend/js/app.js`](https://github.com/moneeshreddych/stockprizepredictor/blob/main/frontend/js/app.js) (Market dashboard), [`api/news_api.py`](https://github.com/moneeshreddych/stockprizepredictor/blob/main/api/news_api.py) (News and chart API), [`api/market_server.py`](https://github.com/moneeshreddych/stockprizepredictor/blob/main/api/market_server.py) (Market and prediction API), [`news/news_collector.py`](https://github.com/moneeshreddych/stockprizepredictor/blob/main/news/news_collector.py) (News collector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Data collection"]
  node_news_collector["News collector<br/>[news_collector.py]"]
  node_history_collector["History collector<br/>[price_collector.py]"]
  node_live_collector["Live collector<br/>[main.py]"]
  node_news_store[("News articles<br/>[schema.sql]")]
  node_price_store[("Price data<br/>[schema.sql]")]
  node_latest_store[("Latest prices<br/>[schema.sql]")]
end

subgraph group_analysis["ML analysis"]
  node_sentiment["FinBERT sentiment<br/>[pipeline.py]"]
  node_forecast["TFT forecasting<br/>[pipeline.py]"]
  node_prediction_store[("Predictions<br/>[schema.sql]")]
end

subgraph group_serving["API services"]
  node_news_api["News and chart API<br/>[news_api.py]"]
  node_market_api["Market and prediction API<br/>[market_server.py]"]
  node_collector_api["Latest price endpoint<br/>[main.py]"]
end

subgraph group_interface["Dashboard"]
  node_dashboard["Market dashboard<br/>[app.js]"]
  node_news_page["News view<br/>[news-renderer.js]"]
  node_prediction_view["Forecast view<br/>[predictions.js]"]
end

node_visitor(("Investor"))
node_news_sources(("News providers"))
node_market_sources(("Market data providers"))
node_provider_news(("News APIs"))
node_provider_twelve(("Twelve Data"))
node_provider_yahoo(("Yahoo Finance"))
node_supabase[("Supabase<br/>[supabase_client.py]")]

node_news_collector -->|"fetches articles"| node_news_sources
node_news_collector -->|"checks and upserts"| node_news_store
node_history_collector -->|"fetches history"| node_market_sources
node_history_collector -->|"upserts history"| node_price_store
node_live_collector -->|"fetches prices"| node_provider_twelve
node_live_collector -->|"upserts prices"| node_latest_store
node_sentiment -->|"reads articles"| node_news_store
node_sentiment -->|"stores scores"| node_prediction_store
node_forecast -->|"uses history"| node_price_store
node_forecast -->|"upserts forecasts"| node_prediction_store
node_news_api -->|"reads articles"| node_news_store
node_news_api -->|"fetches chart data"| node_provider_twelve
node_news_api -.->|"fallback history"| node_provider_yahoo
node_market_api -->|"reads cached prices"| node_latest_store
node_market_api -->|"reads forecasts"| node_prediction_store
node_market_api -->|"fetches market prices"| node_provider_yahoo
node_collector_api -->|"reads latest prices"| node_latest_store
node_dashboard -->|"requests news and history"| node_news_api
node_dashboard -->|"requests market data"| node_market_api
node_dashboard -->|"requests latest prices"| node_collector_api
node_dashboard -->|"renders articles"| node_news_page
node_dashboard -->|"updates forecasts"| node_prediction_view
node_visitor -->|"uses"| node_dashboard
node_news_collector -->|"fetches articles"| node_provider_news
node_sentiment -->|"persists scores"| node_supabase
node_forecast -->|"persists forecasts"| node_supabase

click node_news_collector "https://github.com/moneeshreddych/stockprizepredictor/blob/main/news/news_collector.py"
click node_history_collector "https://github.com/moneeshreddych/stockprizepredictor/blob/main/news/price_collector.py"
click node_live_collector "https://github.com/moneeshreddych/stockprizepredictor/blob/main/src/collector/main.py"
click node_news_store "https://github.com/moneeshreddych/stockprizepredictor/blob/main/database/schema.sql"
click node_price_store "https://github.com/moneeshreddych/stockprizepredictor/blob/main/database/schema.sql"
click node_latest_store "https://github.com/moneeshreddych/stockprizepredictor/blob/main/database/schema.sql"
click node_sentiment "https://github.com/moneeshreddych/stockprizepredictor/blob/main/ml/pipeline.py"
click node_forecast "https://github.com/moneeshreddych/stockprizepredictor/blob/main/ml/pipeline.py"
click node_prediction_store "https://github.com/moneeshreddych/stockprizepredictor/blob/main/database/schema.sql"
click node_news_api "https://github.com/moneeshreddych/stockprizepredictor/blob/main/api/news_api.py"
click node_market_api "https://github.com/moneeshreddych/stockprizepredictor/blob/main/api/market_server.py"
click node_collector_api "https://github.com/moneeshreddych/stockprizepredictor/blob/main/src/collector/main.py"
click node_dashboard "https://github.com/moneeshreddych/stockprizepredictor/blob/main/frontend/js/app.js"
click node_news_page "https://github.com/moneeshreddych/stockprizepredictor/blob/main/frontend/js/news-renderer.js"
click node_prediction_view "https://github.com/moneeshreddych/stockprizepredictor/blob/main/frontend/js/predictions.js"
click node_supabase "https://github.com/moneeshreddych/stockprizepredictor/blob/main/src/database/supabase_client.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_news_collector,node_history_collector,node_live_collector,node_news_store,node_price_store,node_latest_store toneBlue
class node_sentiment,node_forecast,node_prediction_store,node_supabase toneAmber
class node_news_api,node_market_api,node_collector_api,node_provider_news toneMint
class node_dashboard,node_news_page,node_prediction_view toneRose
class node_visitor,node_news_sources,node_market_sources,node_provider_twelve,node_provider_yahoo toneIndigo
```

## Components

### Data collection

- [News collector](https://github.com/moneeshreddych/stockprizepredictor/blob/main/news/news_collector.py): `news/news_collector.py`
- [History collector](https://github.com/moneeshreddych/stockprizepredictor/blob/main/news/price_collector.py): `news/price_collector.py`
- [Live collector](https://github.com/moneeshreddych/stockprizepredictor/blob/main/src/collector/main.py): `src/collector/main.py`
- [News articles](https://github.com/moneeshreddych/stockprizepredictor/blob/main/database/schema.sql): `database/schema.sql`
- [Price data](https://github.com/moneeshreddych/stockprizepredictor/blob/main/database/schema.sql): `database/schema.sql`
- [Latest prices](https://github.com/moneeshreddych/stockprizepredictor/blob/main/database/schema.sql): `database/schema.sql`

### ML analysis

- [FinBERT sentiment](https://github.com/moneeshreddych/stockprizepredictor/blob/main/ml/pipeline.py): `ml/pipeline.py`
- [TFT forecasting](https://github.com/moneeshreddych/stockprizepredictor/blob/main/ml/pipeline.py): `ml/pipeline.py`
- [Predictions](https://github.com/moneeshreddych/stockprizepredictor/blob/main/database/schema.sql): `database/schema.sql`

### API services

- [News and chart API](https://github.com/moneeshreddych/stockprizepredictor/blob/main/api/news_api.py): `api/news_api.py`
- [Market and prediction API](https://github.com/moneeshreddych/stockprizepredictor/blob/main/api/market_server.py): `api/market_server.py`
- [Latest price endpoint](https://github.com/moneeshreddych/stockprizepredictor/blob/main/src/collector/main.py): `src/collector/main.py`

### Dashboard

- [Market dashboard](https://github.com/moneeshreddych/stockprizepredictor/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [News view](https://github.com/moneeshreddych/stockprizepredictor/blob/main/frontend/js/news-renderer.js): `frontend/js/news-renderer.js`
- [Forecast view](https://github.com/moneeshreddych/stockprizepredictor/blob/main/frontend/js/predictions.js): `frontend/js/predictions.js`

### Other components

- **Investor**
- **News providers**
- **Market data providers**
- **News APIs**
- **Twelve Data**
- **Yahoo Finance**
- [Supabase](https://github.com/moneeshreddych/stockprizepredictor/blob/main/src/database/supabase_client.py): `src/database/supabase_client.py`

## Connections

- News collector → News providers: fetches articles
- News collector → News articles: checks and upserts
- History collector → Market data providers: fetches history
- History collector → Price data: upserts history
- Live collector → Twelve Data: fetches prices
- Live collector → Latest prices: upserts prices
- FinBERT sentiment → News articles: reads articles
- FinBERT sentiment → Predictions: stores scores
- TFT forecasting → Price data: uses history
- TFT forecasting → Predictions: upserts forecasts
- News and chart API → News articles: reads articles
- News and chart API → Twelve Data: fetches chart data
- News and chart API → Yahoo Finance: fallback history
- Market and prediction API → Latest prices: reads cached prices
- Market and prediction API → Predictions: reads forecasts
- Market and prediction API → Yahoo Finance: fetches market prices
- Latest price endpoint → Latest prices: reads latest prices
- Market dashboard → News and chart API: requests news and history
- Market dashboard → Market and prediction API: requests market data
- Market dashboard → Latest price endpoint: requests latest prices
- Market dashboard → News view: renders articles
- Market dashboard → Forecast view: updates forecasts
- Investor → Market dashboard: uses
- News collector → News APIs: fetches articles
- FinBERT sentiment → Supabase: persists scores
- TFT forecasting → Supabase: persists forecasts
