# ttsudarshan/market_predictor architecture

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

- Interactive diagram: https://gitdiagram.com/ttsudarshan/market_predictor
- Repository: https://github.com/ttsudarshan/market_predictor

## Overview

Paperdesk combines a paper-trading application with a creator-call research and scoring product. Users authenticate, inspect market data, place simulated orders, and review portfolios; separately, they can track YouTube creators whose calls are extracted from transcripts, verified, scored against SPY, and surfaced in rankings and digests. The graph preserves these distinct workflows and the background insights pipeline. Edges are limited to relationships visible in excerpts or explicitly documented in the README; unsampled wiring is not inferred.

Main entry points: [`backend/PaperTrading.Api/Data/AppDbContext.cs`](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Data/AppDbContext.cs) (SQLite application store), [`frontend/src/app/core/api.service.ts`](https://github.com/ttsudarshan/market_predictor/blob/main/frontend/src/app/core/api.service.ts) (HTTP API client), [`backend/PaperTrading.Api/Controllers/Controllers.cs`](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Controllers/Controllers.cs) (API controllers), [`backend/PaperTrading.Api/Insights/PipelineSteps.cs`](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/PipelineSteps.cs) (Video processing stages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular application"]
  node_pages["Trading and insights pages"]
  node_auth["Authentication session<br/>[auth.service.ts]"]
  node_api["HTTP API client<br/>[api.service.ts]"]
  node_live["Live updates<br/>[live.service.ts]"]
end

subgraph group_trading["Paper trading"]
  node_controllers["API controllers<br/>[Controllers.cs]"]
  node_orders["Order execution<br/>[OrderService.cs]"]
  node_portfolio["Portfolio analytics"]
  node_accounts["Account management<br/>[AccountService.cs]"]
  node_store[("SQLite application store<br/>[AppDbContext.cs]")]
end

subgraph group_market["Market data"]
  node_marketapi["Market endpoints<br/>[Controllers.cs]"]
  node_marketloop["Market and order loop"]
  node_yahoo["Yahoo market feeds"]
  node_simfeed["Simulated price feed"]
  node_hub["SignalR market hub<br/>[MarketHub.cs]"]
end

subgraph group_insights["Creator insights"]
  node_insightcontrollers["Insights controllers"]
  node_pipeline["Insights orchestrator"]
  node_steps["Video processing stages<br/>[PipelineSteps.cs]"]
  node_youtube["YouTube discovery and transcripts<br/>[YouTubeGateway.cs]"]
  node_extractor["Call extraction<br/>[ClaimExtractor.cs]"]
  node_llm["LLM provider client<br/>[LlmClient.cs]"]
  node_scoring["Call scoring<br/>[ScoringService.cs]"]
  node_digest["Digest and sentiment<br/>[DigestService.cs]"]
  node_channel["Creator tracking<br/>[ChannelService.cs]"]
end

node_user(("Trader / researcher"))
node_youtubeext["YouTube"]
node_llmext["LLM service"]
node_spy["SPY benchmark prices"]

node_user -->|"uses"| node_pages
node_pages -->|"requests data"| node_api
node_pages -->|"signs in"| node_auth
node_api -->|"calls trading API"| node_controllers
node_api -->|"calls insights API"| node_insightcontrollers
node_controllers -->|"places orders"| node_orders
node_controllers -->|"fetches portfolio"| node_portfolio
node_controllers -->|"manages accounts"| node_accounts
node_orders -->|"reads and writes"| node_store
node_portfolio -->|"reads portfolio"| node_store
node_accounts -->|"persists accounts"| node_store
node_marketapi -->|"fetches quotes"| node_yahoo
node_marketloop -->|"checks open orders"| node_orders
node_marketloop -->|"publishes updates"| node_hub
node_api -.->|"separate live channel"| node_live
node_pipeline -->|"runs stages"| node_steps
node_steps -->|"discovers and fetches"| node_youtube
node_steps -->|"extracts calls"| node_extractor
node_extractor -->|"asks for predictions"| node_llm
node_pipeline -->|"scores calls"| node_scoring
node_pipeline -->|"writes daily brief"| node_digest
node_insightcontrollers -->|"manages creators"| node_channel
node_steps -->|"saves stage state"| node_store
node_scoring -->|"persists scores"| node_store
node_digest -->|"reads claims"| node_store
node_youtube -->|"retrieves videos"| node_youtubeext
node_llm -->|"analyzes transcripts"| node_llmext
node_scoring -->|"benchmarks returns"| node_spy
node_simfeed -.->|"supplies simulated prices"| node_marketloop

click node_pages "https://github.com/ttsudarshan/market_predictor/tree/main/frontend/src/app/pages"
click node_auth "https://github.com/ttsudarshan/market_predictor/blob/main/frontend/src/app/core/auth.service.ts"
click node_api "https://github.com/ttsudarshan/market_predictor/blob/main/frontend/src/app/core/api.service.ts"
click node_live "https://github.com/ttsudarshan/market_predictor/blob/main/frontend/src/app/core/live.service.ts"
click node_controllers "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Controllers/Controllers.cs"
click node_insightcontrollers "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Controllers/InsightsControllers.cs"
click node_orders "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Services/OrderService.cs"
click node_portfolio "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Services/PortfolioService.cs"
click node_accounts "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Services/AccountService.cs"
click node_store "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Data/AppDbContext.cs"
click node_marketapi "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Controllers/Controllers.cs"
click node_marketloop "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Services/MarketLoopService.cs"
click node_yahoo "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/MarketData/YahooMarketDataProvider.cs"
click node_simfeed "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/MarketData/SimulatedMarketDataProvider.cs"
click node_hub "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Hubs/MarketHub.cs"
click node_pipeline "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/InsightsPipelineService.cs"
click node_steps "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/PipelineSteps.cs"
click node_youtube "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/YouTubeGateway.cs"
click node_extractor "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/ClaimExtractor.cs"
click node_llm "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/LlmClient.cs"
click node_scoring "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/ScoringService.cs"
click node_digest "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/DigestService.cs"
click node_channel "https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/ChannelService.cs"

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_pages,node_auth,node_api,node_live toneBlue
class node_controllers,node_orders,node_portfolio,node_accounts,node_store toneAmber
class node_marketapi,node_marketloop,node_yahoo,node_simfeed,node_hub toneMint
class node_insightcontrollers,node_pipeline,node_steps,node_youtube,node_extractor,node_llm,node_scoring,node_digest,node_channel toneRose
class node_user,node_youtubeext,node_llmext,node_spy toneIndigo
```

## Components

### Angular application

- [Trading and insights pages](https://github.com/ttsudarshan/market_predictor/tree/main/frontend/src/app/pages): `frontend/src/app/pages`
- [Authentication session](https://github.com/ttsudarshan/market_predictor/blob/main/frontend/src/app/core/auth.service.ts): `frontend/src/app/core/auth.service.ts`
- [HTTP API client](https://github.com/ttsudarshan/market_predictor/blob/main/frontend/src/app/core/api.service.ts): `frontend/src/app/core/api.service.ts`
- [Live updates](https://github.com/ttsudarshan/market_predictor/blob/main/frontend/src/app/core/live.service.ts): `frontend/src/app/core/live.service.ts`

### Paper trading

- [API controllers](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Controllers/Controllers.cs): `backend/PaperTrading.Api/Controllers/Controllers.cs`
- [Order execution](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Services/OrderService.cs): `backend/PaperTrading.Api/Services/OrderService.cs`
- [Portfolio analytics](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Services/PortfolioService.cs): `backend/PaperTrading.Api/Services/PortfolioService.cs`
- [Account management](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Services/AccountService.cs): `backend/PaperTrading.Api/Services/AccountService.cs`
- [SQLite application store](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Data/AppDbContext.cs): `backend/PaperTrading.Api/Data/AppDbContext.cs`

### Market data

- [Market endpoints](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Controllers/Controllers.cs): `backend/PaperTrading.Api/Controllers/Controllers.cs`
- [Market and order loop](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Services/MarketLoopService.cs): `backend/PaperTrading.Api/Services/MarketLoopService.cs`
- [Yahoo market feeds](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/MarketData/YahooMarketDataProvider.cs): `backend/PaperTrading.Api/MarketData/YahooMarketDataProvider.cs`
- [Simulated price feed](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/MarketData/SimulatedMarketDataProvider.cs): `backend/PaperTrading.Api/MarketData/SimulatedMarketDataProvider.cs`
- [SignalR market hub](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Hubs/MarketHub.cs): `backend/PaperTrading.Api/Hubs/MarketHub.cs`

### Creator insights

- [Insights controllers](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Controllers/InsightsControllers.cs): `backend/PaperTrading.Api/Controllers/InsightsControllers.cs`
- [Insights orchestrator](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/InsightsPipelineService.cs): `backend/PaperTrading.Api/Insights/InsightsPipelineService.cs`
- [Video processing stages](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/PipelineSteps.cs): `backend/PaperTrading.Api/Insights/PipelineSteps.cs`
- [YouTube discovery and transcripts](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/YouTubeGateway.cs): `backend/PaperTrading.Api/Insights/YouTubeGateway.cs`
- [Call extraction](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/ClaimExtractor.cs): `backend/PaperTrading.Api/Insights/ClaimExtractor.cs`
- [LLM provider client](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/LlmClient.cs): `backend/PaperTrading.Api/Insights/LlmClient.cs`
- [Call scoring](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/ScoringService.cs): `backend/PaperTrading.Api/Insights/ScoringService.cs`
- [Digest and sentiment](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/DigestService.cs): `backend/PaperTrading.Api/Insights/DigestService.cs`
- [Creator tracking](https://github.com/ttsudarshan/market_predictor/blob/main/backend/PaperTrading.Api/Insights/ChannelService.cs): `backend/PaperTrading.Api/Insights/ChannelService.cs`

### Other components

- **Trader / researcher**
- **YouTube**
- **LLM service**
- **SPY benchmark prices**

## Connections

- Trader / researcher → Trading and insights pages: uses
- Trading and insights pages → HTTP API client: requests data (evidence: `frontend/src/app/core/api.service.ts`)
- Trading and insights pages → Authentication session: signs in (evidence: `frontend/src/app/core/auth.service.ts`)
- HTTP API client → API controllers: calls trading API (evidence: `frontend/src/app/core/api.service.ts`)
- HTTP API client → Insights controllers: calls insights API (evidence: `frontend/src/app/core/api.service.ts`)
- API controllers → Order execution: places orders (evidence: `backend/PaperTrading.Api/Controllers/Controllers.cs`)
- API controllers → Portfolio analytics: fetches portfolio (evidence: `backend/PaperTrading.Api/Controllers/Controllers.cs`)
- API controllers → Account management: manages accounts (evidence: `backend/PaperTrading.Api/Controllers/Controllers.cs`)
- Order execution → SQLite application store: reads and writes (evidence: `backend/PaperTrading.Api/Services/OrderService.cs`)
- Portfolio analytics → SQLite application store: reads portfolio (evidence: `backend/PaperTrading.Api/Services/PortfolioService.cs`)
- Account management → SQLite application store: persists accounts (evidence: `backend/PaperTrading.Api/Services/AccountService.cs`)
- Market endpoints → Yahoo market feeds: fetches quotes
- Market and order loop → Order execution: checks open orders (evidence: `backend/PaperTrading.Api/Program.cs`)
- Market and order loop → SignalR market hub: publishes updates (evidence: `backend/PaperTrading.Api/Program.cs`)
- HTTP API client → Live updates: separate live channel
- Insights orchestrator → Video processing stages: runs stages (evidence: `backend/PaperTrading.Api/Insights/InsightsPipelineService.cs`)
- Video processing stages → YouTube discovery and transcripts: discovers and fetches (evidence: `backend/PaperTrading.Api/Insights/PipelineSteps.cs`)
- Video processing stages → Call extraction: extracts calls (evidence: `backend/PaperTrading.Api/Insights/PipelineSteps.cs`)
- Call extraction → LLM provider client: asks for predictions (evidence: `backend/PaperTrading.Api/Insights/ClaimExtractor.cs`)
- Insights orchestrator → Call scoring: scores calls (evidence: `backend/PaperTrading.Api/Insights/InsightsPipelineService.cs`)
- Insights orchestrator → Digest and sentiment: writes daily brief (evidence: `backend/PaperTrading.Api/Insights/InsightsPipelineService.cs`)
- Insights controllers → Creator tracking: manages creators (evidence: `backend/PaperTrading.Api/Controllers/InsightsControllers.cs`)
- Video processing stages → SQLite application store: saves stage state (evidence: `backend/PaperTrading.Api/Insights/PipelineSteps.cs`)
- Call scoring → SQLite application store: persists scores (evidence: `backend/PaperTrading.Api/Insights/ScoringService.cs`)
- Digest and sentiment → SQLite application store: reads claims (evidence: `backend/PaperTrading.Api/Insights/DigestService.cs`)
- YouTube discovery and transcripts → YouTube: retrieves videos (evidence: `README.md`)
- LLM provider client → LLM service: analyzes transcripts (evidence: `README.md`)
- Call scoring → SPY benchmark prices: benchmarks returns (evidence: `README.md`)
- Simulated price feed → Market and order loop: supplies simulated prices
