# a1704/ai-investment-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/a1704/ai-investment-assistant
- Repository: https://github.com/a1704/ai-investment-assistant

## Overview

AI Investment Assistant is an informational portfolio-tracking and decision-support application, not a trading system. Users view portfolio data in the Flask dashboard or ask questions through its assistant; portfolio calculations and market/news inputs support analytics, alerts, AI explanations, goals, and daily briefings. Voice interaction and safe computer control are documented capabilities, but their initiating routes are not fully shown. The graph preserves those documented branches; edges without source-level wiring rely on README architecture statements, and unsampled integrations are not inferred.

Main entry points: [`investment_assistant/assistant.py`](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/assistant.py) (Conversational assistant), [`investment_assistant/briefing.py`](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/briefing.py) (Daily briefing), [`dashboard/app.py`](https://github.com/a1704/ai-investment-assistant/blob/main/dashboard/app.py) (Flask dashboard), [`investment_assistant/portfolio.py`](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/portfolio.py) (Portfolio engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_dashboard["Flask dashboard<br/>[app.py]"]
  node_assistant["Conversational assistant<br/>[assistant.py]"]
  node_voice["Voice interaction"]
  node_computer["Safe computer control"]
end

subgraph group_portfolio["Portfolio data"]
  node_portfolio_engine["Portfolio engine<br/>[portfolio.py]"]
  node_database[("SQLite persistence<br/>[database.py]")]
  node_market["Market data<br/>[market_data.py]"]
  node_news["Financial news<br/>[news.py]"]
end

subgraph group_insight["Analysis and insight"]
  node_alerts["Portfolio change alerts<br/>[alerts.py]"]
  node_intelligence["Portfolio intelligence<br/>[intelligence.py]"]
  node_risk["Risk analysis"]
  node_historical["Historical analytics"]
  node_attribution["Performance attribution"]
  node_goals["Goals and benchmarks"]
  node_quality["Data quality<br/>[data_quality.py]"]
  node_ai["AI analysis<br/>[ai_analysis.py]"]
end

subgraph group_delivery["Briefings and actions"]
  node_briefing["Daily briefing<br/>[briefing.py]"]
  node_email["Email delivery<br/>[gmail_sender.py]"]
end

node_user(("User"))
node_market_service["Quote provider"]
node_news_service["News feeds"]
node_gemini["Gemini service"]
node_gmail["Gmail"]

node_user -->|"views portfolio"| node_dashboard
node_user -->|"asks questions"| node_assistant
node_voice -.->|"submits questions"| node_assistant
node_dashboard -->|"loads portfolio"| node_portfolio_engine
node_portfolio_engine -->|"reads and writes"| node_database
node_portfolio_engine -->|"gets quotes"| node_market
node_market -.->|"retrieves prices"| node_market_service
node_news -->|"collects headlines"| node_news_service
node_dashboard -->|"loads news"| node_news
node_dashboard -->|"calculates changes"| node_alerts
node_dashboard -->|"generates insights"| node_intelligence
node_dashboard -->|"generates risk report"| node_risk
node_dashboard -->|"loads history"| node_historical
node_dashboard -->|"loads attribution"| node_attribution
node_dashboard -->|"loads goal report"| node_goals
node_dashboard -->|"checks data quality"| node_quality
node_dashboard -->|"requests analysis"| node_ai
node_assistant -->|"uses portfolio data"| node_portfolio_engine
node_assistant -->|"requests analysis"| node_ai
node_assistant -->|"uses change alerts"| node_alerts
node_assistant -->|"uses insights"| node_intelligence
node_assistant -->|"uses history"| node_historical
node_assistant -->|"uses attribution"| node_attribution
node_assistant -->|"uses risk analysis"| node_risk
node_assistant -->|"uses goal reports"| node_goals
node_assistant -->|"uses quality reports"| node_quality
node_assistant -->|"uses news"| node_news
node_assistant -->|"parses commands"| node_computer
node_ai -->|"requests generation"| node_gemini
node_briefing -->|"builds portfolio summary"| node_portfolio_engine
node_briefing -->|"includes alerts"| node_alerts
node_briefing -->|"generates analysis"| node_ai
node_briefing -->|"includes insights"| node_intelligence
node_briefing -->|"includes risk report"| node_risk
node_briefing -->|"includes history"| node_historical
node_briefing -->|"includes attribution"| node_attribution
node_briefing -->|"includes goals"| node_goals
node_briefing -->|"includes quality report"| node_quality
node_briefing -->|"includes news"| node_news
node_briefing -.->|"sends briefing"| node_email
node_email -.->|"delivers email"| node_gmail

click node_dashboard "https://github.com/a1704/ai-investment-assistant/blob/main/dashboard/app.py"
click node_assistant "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/assistant.py"
click node_computer "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/computer_control.py"
click node_portfolio_engine "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/portfolio.py"
click node_database "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/database.py"
click node_market "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/market_data.py"
click node_news "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/news.py"
click node_alerts "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/alerts.py"
click node_intelligence "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/intelligence.py"
click node_risk "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/risk_intelligence.py"
click node_historical "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/historical_analytics.py"
click node_attribution "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/performance_attribution.py"
click node_goals "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/goals_intelligence.py"
click node_quality "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/data_quality.py"
click node_ai "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/ai_analysis.py"
click node_briefing "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/briefing.py"
click node_email "https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/gmail_sender.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_dashboard,node_assistant,node_voice,node_computer,node_user toneBlue
class node_portfolio_engine,node_database,node_market,node_news toneAmber
class node_alerts,node_intelligence,node_risk,node_historical,node_attribution,node_goals,node_quality,node_ai toneMint
class node_briefing,node_email toneRose
class node_market_service,node_news_service,node_gemini,node_gmail toneIndigo
```

## Components

### User interfaces

- [Flask dashboard](https://github.com/a1704/ai-investment-assistant/blob/main/dashboard/app.py): `dashboard/app.py`
- [Conversational assistant](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/assistant.py): `investment_assistant/assistant.py`
- **Voice interaction**
- [Safe computer control](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/computer_control.py): `investment_assistant/computer_control.py`

### Portfolio data

- [Portfolio engine](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/portfolio.py): `investment_assistant/portfolio.py`
- [SQLite persistence](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/database.py): `investment_assistant/database.py`
- [Market data](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/market_data.py): `investment_assistant/market_data.py`
- [Financial news](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/news.py): `investment_assistant/news.py`

### Analysis and insight

- [Portfolio change alerts](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/alerts.py): `investment_assistant/alerts.py`
- [Portfolio intelligence](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/intelligence.py): `investment_assistant/intelligence.py`
- [Risk analysis](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/risk_intelligence.py): `investment_assistant/risk_intelligence.py`
- [Historical analytics](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/historical_analytics.py): `investment_assistant/historical_analytics.py`
- [Performance attribution](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/performance_attribution.py): `investment_assistant/performance_attribution.py`
- [Goals and benchmarks](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/goals_intelligence.py): `investment_assistant/goals_intelligence.py`
- [Data quality](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/data_quality.py): `investment_assistant/data_quality.py`
- [AI analysis](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/ai_analysis.py): `investment_assistant/ai_analysis.py`

### Briefings and actions

- [Daily briefing](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/briefing.py): `investment_assistant/briefing.py`
- [Email delivery](https://github.com/a1704/ai-investment-assistant/blob/main/investment_assistant/gmail_sender.py): `investment_assistant/gmail_sender.py`

### Other components

- **User**
- **Quote provider**
- **News feeds**
- **Gemini service**
- **Gmail**

## Connections

- User → Flask dashboard: views portfolio (evidence: `README.md`)
- User → Conversational assistant: asks questions (evidence: `README.md`)
- Voice interaction → Conversational assistant: submits questions
- Flask dashboard → Portfolio engine: loads portfolio (evidence: `README.md`)
- Portfolio engine → SQLite persistence: reads and writes (evidence: `investment_assistant/portfolio.py`)
- Portfolio engine → Market data: gets quotes (evidence: `investment_assistant/portfolio.py`)
- Market data → Quote provider: retrieves prices
- Financial news → News feeds: collects headlines (evidence: `investment_assistant/news.py`)
- Flask dashboard → Financial news: loads news (evidence: `dashboard/app.py`)
- Flask dashboard → Portfolio change alerts: calculates changes (evidence: `dashboard/app.py`)
- Flask dashboard → Portfolio intelligence: generates insights (evidence: `dashboard/app.py`)
- Flask dashboard → Risk analysis: generates risk report (evidence: `dashboard/app.py`)
- Flask dashboard → Historical analytics: loads history (evidence: `dashboard/app.py`)
- Flask dashboard → Performance attribution: loads attribution (evidence: `dashboard/app.py`)
- Flask dashboard → Goals and benchmarks: loads goal report (evidence: `dashboard/app.py`)
- Flask dashboard → Data quality: checks data quality (evidence: `dashboard/app.py`)
- Flask dashboard → AI analysis: requests analysis (evidence: `README.md`)
- Conversational assistant → Portfolio engine: uses portfolio data (evidence: `README.md`)
- Conversational assistant → AI analysis: requests analysis (evidence: `investment_assistant/assistant.py`)
- Conversational assistant → Portfolio change alerts: uses change alerts (evidence: `investment_assistant/assistant.py`)
- Conversational assistant → Portfolio intelligence: uses insights (evidence: `investment_assistant/assistant.py`)
- Conversational assistant → Historical analytics: uses history (evidence: `investment_assistant/assistant.py`)
- Conversational assistant → Performance attribution: uses attribution (evidence: `investment_assistant/assistant.py`)
- Conversational assistant → Risk analysis: uses risk analysis (evidence: `investment_assistant/assistant.py`)
- Conversational assistant → Goals and benchmarks: uses goal reports (evidence: `investment_assistant/assistant.py`)
- Conversational assistant → Data quality: uses quality reports (evidence: `investment_assistant/assistant.py`)
- Conversational assistant → Financial news: uses news (evidence: `investment_assistant/assistant.py`)
- Conversational assistant → Safe computer control: parses commands (evidence: `investment_assistant/assistant.py`)
- AI analysis → Gemini service: requests generation (evidence: `investment_assistant/ai_analysis.py`)
- Daily briefing → Portfolio engine: builds portfolio summary (evidence: `README.md`)
- Daily briefing → Portfolio change alerts: includes alerts (evidence: `investment_assistant/briefing.py`)
- Daily briefing → AI analysis: generates analysis (evidence: `investment_assistant/briefing.py`)
- Daily briefing → Portfolio intelligence: includes insights (evidence: `investment_assistant/briefing.py`)
- Daily briefing → Risk analysis: includes risk report (evidence: `investment_assistant/briefing.py`)
- Daily briefing → Historical analytics: includes history (evidence: `investment_assistant/briefing.py`)
- Daily briefing → Performance attribution: includes attribution (evidence: `investment_assistant/briefing.py`)
- Daily briefing → Goals and benchmarks: includes goals (evidence: `investment_assistant/briefing.py`)
- Daily briefing → Data quality: includes quality report (evidence: `investment_assistant/briefing.py`)
- Daily briefing → Financial news: includes news (evidence: `investment_assistant/briefing.py`)
- Daily briefing → Email delivery: sends briefing (evidence: `README.md`)
- Email delivery → Gmail: delivers email (evidence: `README.md`)
