# unaveragetech/infobroker architecture

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

- Interactive diagram: https://gitdiagram.com/unaveragetech/infobroker
- Repository: https://github.com/unaveragetech/infobroker
- Video tour (about a minute): https://gitdiagram.com/unaveragetech/infobroker/video

## Overview

Infobroker is a local trading desk for market research, learning, and trading, paper-first with optional live brokers and an Ollama coach. The principal workflow is browser desk → web API → market universe/data and analysis → displayed board or chart; trading requests pass through the API to a broker and portfolio state. Separate capabilities include strategies, lessons, Grapevine/MCP, and market-session clocks. The README documents the broad runtime wiring; source-index references and excerpts support selected internal calls. Unsampled modules are represented as product subsystems without asserting unverified connections.

Main entry points: [`infobroker/web/app.py`](https://github.com/unaveragetech/infobroker/blob/main/infobroker/web/app.py) (Web API), [`infobroker/assistant/tools.py`](https://github.com/unaveragetech/infobroker/blob/main/infobroker/assistant/tools.py) (Grapevine tools), [`infobroker/universe/engine.py`](https://github.com/unaveragetech/infobroker/blob/main/infobroker/universe/engine.py) (Universe engine), [`infobroker/data/market.py`](https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/market.py) (Market data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desk["Desk API"]
  node_web["Web API<br/>[app.py]"]
  node_desk_ui["Browser UI<br/>[app.js]"]
end

subgraph group_markets["Market research"]
  node_universe["Universe engine<br/>[engine.py]"]
  node_universe_store[("Universe cache<br/>[store.py]")]
  node_market_data["Market data<br/>[market.py]"]
  node_data_pipeline["Yahoo analysis<br/>[yf_pipeline.py]"]
  node_providers["Data providers<br/>[providers.py]"]
  node_multi_source["Multi-source board<br/>[multisource.py]"]
  node_highlights["Market highlights<br/>[highlights.py]"]
  node_sessions["Market clocks<br/>[sessions.py]"]
  node_chartpack["Chart packs<br/>[chartpack.py]"]
  node_strategies["Strategies<br/>[backtest.py]"]
  node_indicators["Market indicators<br/>[indicators.py]"]
end

subgraph group_trading["Trading"]
  node_broker_api["Broker contract<br/>[base.py]"]
  node_paper["Paper broker<br/>[paper.py]"]
  node_broker_registry["Broker adapters<br/>[registry.py]"]
  node_portfolio["Portfolio<br/>[portfolio.py]"]
end

subgraph group_learning["Learning and assistant"]
  node_assistant["Grapevine tools<br/>[tools.py]"]
  node_agent["Assistant agent<br/>[agent.py]"]
  node_ollama["Ollama client<br/>[ollama_client.py]"]
  node_lessons["Lessons and tutor<br/>[lessons.py]"]
  node_trade_stories["Trade stories<br/>[trade_stories.py]"]
  node_mcp["MCP bridge<br/>[mcp_server.py]"]
end

subgraph group_platform["Desk services"]
  node_settings["Desk settings<br/>[config.py]"]
  node_process_control["Process control<br/>[process_control.py]"]
end

node_browser(("Desk user"))
node_yahoo(("Yahoo Finance"))
node_ollama_service(("Ollama service"))
node_broker_service(("External brokers"))

node_browser -->|"uses"| node_desk_ui
node_desk_ui -->|"requests"| node_web
node_web -->|"routes to"| node_universe
node_web -->|"routes to"| node_assistant
node_web -->|"creates broker"| node_broker_registry
node_web -->|"runs backtests"| node_strategies
node_web -->|"serves learning"| node_lessons
node_web -->|"builds live board"| node_multi_source
node_universe -->|"loads and saves"| node_universe_store
node_universe -->|"refreshes quotes"| node_multi_source
node_universe -->|"fetches quotes"| node_yahoo
node_multi_source -->|"uses fallback"| node_providers
node_market_data -->|"downloads history"| node_data_pipeline
node_market_data -->|"uses fallback"| node_providers
node_data_pipeline -->|"downloads prices"| node_yahoo
node_data_pipeline -->|"adds indicators"| node_indicators
node_web -->|"serves charts"| node_chartpack
node_strategies -->|"reads history"| node_market_data
node_strategies -->|"uses indicators"| node_indicators
node_web -->|"reports market hours"| node_sessions
node_web -->|"places orders"| node_paper
node_paper -->|"implements contract"| node_broker_api
node_paper -->|"gets last price"| node_market_data
node_broker_registry -->|"registers adapters"| node_broker_api
node_broker_registry -.->|"connects live"| node_broker_service
node_web -->|"serves account"| node_portfolio
node_assistant -->|"reads market cache"| node_universe
node_assistant -->|"requests market data"| node_market_data
node_assistant -->|"invokes coach"| node_ollama
node_agent -.->|"executes tools"| node_assistant
node_ollama -->|"sends chat"| node_ollama_service
node_process_control -->|"checks health"| node_ollama
node_mcp -.->|"exposes tools"| node_assistant
node_web -->|"serves trade stories"| node_trade_stories
node_settings -->|"configures runtime"| node_web

click node_web "https://github.com/unaveragetech/infobroker/blob/main/infobroker/web/app.py"
click node_desk_ui "https://github.com/unaveragetech/infobroker/blob/main/infobroker/web/static/app.js"
click node_universe "https://github.com/unaveragetech/infobroker/blob/main/infobroker/universe/engine.py"
click node_universe_store "https://github.com/unaveragetech/infobroker/blob/main/infobroker/universe/store.py"
click node_market_data "https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/market.py"
click node_data_pipeline "https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/yf_pipeline.py"
click node_providers "https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/providers.py"
click node_multi_source "https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/multisource.py"
click node_highlights "https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/highlights.py"
click node_sessions "https://github.com/unaveragetech/infobroker/blob/main/infobroker/markets/sessions.py"
click node_chartpack "https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/chartpack.py"
click node_strategies "https://github.com/unaveragetech/infobroker/blob/main/infobroker/strategies/backtest.py"
click node_indicators "https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/indicators.py"
click node_broker_api "https://github.com/unaveragetech/infobroker/blob/main/infobroker/brokers/base.py"
click node_paper "https://github.com/unaveragetech/infobroker/blob/main/infobroker/brokers/paper.py"
click node_broker_registry "https://github.com/unaveragetech/infobroker/blob/main/infobroker/brokers/registry.py"
click node_portfolio "https://github.com/unaveragetech/infobroker/blob/main/infobroker/portfolio.py"
click node_assistant "https://github.com/unaveragetech/infobroker/blob/main/infobroker/assistant/tools.py"
click node_agent "https://github.com/unaveragetech/infobroker/blob/main/infobroker/assistant/agent.py"
click node_ollama "https://github.com/unaveragetech/infobroker/blob/main/infobroker/assistant/ollama_client.py"
click node_lessons "https://github.com/unaveragetech/infobroker/blob/main/infobroker/education/lessons.py"
click node_trade_stories "https://github.com/unaveragetech/infobroker/blob/main/infobroker/education/trade_stories.py"
click node_mcp "https://github.com/unaveragetech/infobroker/blob/main/infobroker/mcp_server.py"
click node_settings "https://github.com/unaveragetech/infobroker/blob/main/infobroker/config.py"
click node_process_control "https://github.com/unaveragetech/infobroker/blob/main/infobroker/services/process_control.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_web,node_desk_ui,node_browser toneBlue
class node_universe,node_universe_store,node_market_data,node_data_pipeline,node_providers,node_multi_source,node_highlights,node_sessions,node_chartpack,node_strategies,node_indicators toneAmber
class node_broker_api,node_paper,node_broker_registry,node_portfolio toneMint
class node_assistant,node_agent,node_ollama,node_lessons,node_trade_stories,node_mcp toneRose
class node_settings,node_process_control,node_yahoo,node_ollama_service,node_broker_service toneIndigo
```

## Components

### Desk API

- [Web API](https://github.com/unaveragetech/infobroker/blob/main/infobroker/web/app.py): `infobroker/web/app.py`
- [Browser UI](https://github.com/unaveragetech/infobroker/blob/main/infobroker/web/static/app.js): `infobroker/web/static/app.js`

### Market research

- [Universe engine](https://github.com/unaveragetech/infobroker/blob/main/infobroker/universe/engine.py): `infobroker/universe/engine.py`
- [Universe cache](https://github.com/unaveragetech/infobroker/blob/main/infobroker/universe/store.py): `infobroker/universe/store.py`
- [Market data](https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/market.py): `infobroker/data/market.py`
- [Yahoo analysis](https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/yf_pipeline.py): `infobroker/data/yf_pipeline.py`
- [Data providers](https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/providers.py): `infobroker/data/providers.py`
- [Multi-source board](https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/multisource.py): `infobroker/data/multisource.py`
- [Market highlights](https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/highlights.py): `infobroker/data/highlights.py`
- [Market clocks](https://github.com/unaveragetech/infobroker/blob/main/infobroker/markets/sessions.py): `infobroker/markets/sessions.py`
- [Chart packs](https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/chartpack.py): `infobroker/data/chartpack.py`
- [Strategies](https://github.com/unaveragetech/infobroker/blob/main/infobroker/strategies/backtest.py): `infobroker/strategies/backtest.py`
- [Market indicators](https://github.com/unaveragetech/infobroker/blob/main/infobroker/data/indicators.py): `infobroker/data/indicators.py`

### Trading

- [Broker contract](https://github.com/unaveragetech/infobroker/blob/main/infobroker/brokers/base.py): `infobroker/brokers/base.py`
- [Paper broker](https://github.com/unaveragetech/infobroker/blob/main/infobroker/brokers/paper.py): `infobroker/brokers/paper.py`
- [Broker adapters](https://github.com/unaveragetech/infobroker/blob/main/infobroker/brokers/registry.py): `infobroker/brokers/registry.py`
- [Portfolio](https://github.com/unaveragetech/infobroker/blob/main/infobroker/portfolio.py): `infobroker/portfolio.py`

### Learning and assistant

- [Grapevine tools](https://github.com/unaveragetech/infobroker/blob/main/infobroker/assistant/tools.py): `infobroker/assistant/tools.py`
- [Assistant agent](https://github.com/unaveragetech/infobroker/blob/main/infobroker/assistant/agent.py): `infobroker/assistant/agent.py`
- [Ollama client](https://github.com/unaveragetech/infobroker/blob/main/infobroker/assistant/ollama_client.py): `infobroker/assistant/ollama_client.py`
- [Lessons and tutor](https://github.com/unaveragetech/infobroker/blob/main/infobroker/education/lessons.py): `infobroker/education/lessons.py`
- [Trade stories](https://github.com/unaveragetech/infobroker/blob/main/infobroker/education/trade_stories.py): `infobroker/education/trade_stories.py`
- [MCP bridge](https://github.com/unaveragetech/infobroker/blob/main/infobroker/mcp_server.py): `infobroker/mcp_server.py`

### Desk services

- [Desk settings](https://github.com/unaveragetech/infobroker/blob/main/infobroker/config.py): `infobroker/config.py`
- [Process control](https://github.com/unaveragetech/infobroker/blob/main/infobroker/services/process_control.py): `infobroker/services/process_control.py`

### Other components

- **Desk user**
- **Yahoo Finance**
- **Ollama service**
- **External brokers**

## Connections

- Desk user → Browser UI: uses (evidence: `README.md`)
- Browser UI → Web API: requests (evidence: `README.md`)
- Web API → Universe engine: routes to (evidence: `README.md`)
- Web API → Grapevine tools: routes to (evidence: `README.md`)
- Web API → Broker adapters: creates broker (evidence: `infobroker/web/app.py`)
- Web API → Strategies: runs backtests (evidence: `infobroker/web/app.py`)
- Web API → Lessons and tutor: serves learning (evidence: `infobroker/web/app.py`)
- Web API → Multi-source board: builds live board (evidence: `infobroker/web/app.py`)
- Universe engine → Universe cache: loads and saves (evidence: `infobroker/universe/engine.py`)
- Universe engine → Multi-source board: refreshes quotes (evidence: `infobroker/universe/engine.py`)
- Universe engine → Yahoo Finance: fetches quotes (evidence: `README.md`)
- Multi-source board → Data providers: uses fallback (evidence: `infobroker/data/multisource.py`)
- Market data → Yahoo analysis: downloads history (evidence: `infobroker/data/market.py`)
- Market data → Data providers: uses fallback (evidence: `infobroker/data/market.py`)
- Yahoo analysis → Yahoo Finance: downloads prices (evidence: `infobroker/data/yf_pipeline.py`)
- Yahoo analysis → Market indicators: adds indicators (evidence: `infobroker/data/yf_pipeline.py`)
- Web API → Chart packs: serves charts (evidence: `infobroker/web/app.py`)
- Strategies → Market data: reads history (evidence: `infobroker/strategies/backtest.py`)
- Strategies → Market indicators: uses indicators (evidence: `infobroker/strategies/backtest.py`)
- Web API → Market clocks: reports market hours (evidence: `README.md`)
- Web API → Paper broker: places orders (evidence: `README.md`)
- Paper broker → Broker contract: implements contract (evidence: `infobroker/brokers/paper.py`)
- Paper broker → Market data: gets last price (evidence: `infobroker/brokers/paper.py`)
- Broker adapters → Broker contract: registers adapters (evidence: `infobroker/brokers/__init__.py`)
- Broker adapters → External brokers: connects live (evidence: `README.md`)
- Web API → Portfolio: serves account (evidence: `README.md`)
- Grapevine tools → Universe engine: reads market cache (evidence: `infobroker/assistant/tools.py`)
- Grapevine tools → Market data: requests market data (evidence: `infobroker/assistant/tools.py`)
- Grapevine tools → Ollama client: invokes coach (evidence: `README.md`)
- Assistant agent → Grapevine tools: executes tools
- Ollama client → Ollama service: sends chat (evidence: `infobroker/assistant/ollama_client.py`)
- Process control → Ollama client: checks health (evidence: `infobroker/services/process_control.py`)
- MCP bridge → Grapevine tools: exposes tools (evidence: `README.md`)
- Web API → Trade stories: serves trade stories (evidence: `infobroker/web/app.py`)
- Desk settings → Web API: configures runtime (evidence: `infobroker/web/app.py`)
