# thangvawn/agent_financial architecture

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

- Interactive diagram: https://gitdiagram.com/thangvawn/agent_financial
- Repository: https://github.com/thangvawn/agent_financial

## Overview

Risk Dashboard provides Vietnamese-market risk analysis and a React product dashboard. The documented data-to-result workflow ingests market and macro series into a panel, runs quantitative risk models, optionally adds multi-agent/LLM analysis, and serves results through FastAPI to the dashboard. Product routes also cover onboarding, financial health, goals, investing, news, learning, community, Pro Lab, and administration. Edges between sampled backend components use the excerpts or SOURCE INDEX; broader subsystem links rely on README statements, so unsampled internal calls are not inferred.

Main entry points: [`src/risk_dashboard/api/main.py`](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/api/main.py) (FastAPI service), [`src/risk_dashboard/quant/eod_pipeline.py`](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/quant/eod_pipeline.py) (EOD quant pipeline), [`src/risk_dashboard/modules/guided_investing/application/services.py`](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/guided_investing/application/services.py) (Guided investing), [`frontend/src/App.jsx`](https://github.com/thangvawn/agent_financial/blob/version1/frontend/src/App.jsx) (React application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard experience"]
  node_react["React application<br/>[App.jsx]"]
  node_routes["Product routes<br/>[domainRoutes.js]"]
  node_fastapi["FastAPI service<br/>[main.py]"]
end

subgraph group_market["Market data and quant"]
  node_ingest_cli["Data ingestion CLI<br/>[ingest.py]"]
  node_panel_build["Panel construction<br/>[ingest.py]"]
  node_panel_store[("Panel runtime store<br/>[panel_store.py]")]
  node_watchlist_prices["Watchlist prices"]
  node_eod["EOD quant pipeline<br/>[eod_pipeline.py]"]
  node_xgb["Risk model<br/>[xgb_engine.py]"]
  node_var["VAR analysis<br/>[var_engine.py]"]
  node_backtest["Portfolio backtests<br/>[backtest.py]"]
  node_snapshots["Risk snapshots<br/>[snapshots.py]"]
end

subgraph group_analysis["Analysis and assistant"]
  node_agents["Multi-agent analysis<br/>[multi_agent.py]"]
  node_assistant["AI assistant<br/>[services.py]"]
  node_news["News intelligence<br/>[services.py]"]
end

subgraph group_products["User products"]
  node_guided["Guided investing<br/>[services.py]"]
  node_guided_rules["Investing policies<br/>[policies.py]"]
  node_financial_health["Financial health"]
  node_goals["Goals"]
  node_home_onboarding["Home and onboarding"]
  node_learning["Learning"]
  node_community["Community<br/>[services.py]"]
  node_pro_lab["Pro Lab<br/>[services.py]"]
  node_pro_lab_providers["Provider registry<br/>[registry.py]"]
end

subgraph group_operations["Administration and safety"]
  node_admin_cms["Content operations<br/>[runtime_reader.py]"]
  node_admin_cms_db[("Content repository<br/>[sqlite.py]")]
  node_trust["Trust and safety<br/>[services.py]"]
  node_trust_db[("Trust repository<br/>[sqlite.py]")]
  node_analytics["Product analytics<br/>[emitter.py]"]
  node_analytics_db[("Analytics repository<br/>[sqlite.py]")]
  node_app_state[("Application state DB<br/>[app_state.py]")]
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_react
node_react -->|"resolves routes"| node_routes
node_react -.->|"requests data"| node_fastapi
node_fastapi -->|"loads panel"| node_panel_store
node_ingest_cli -->|"runs ingestion"| node_panel_build
node_ingest_cli -->|"writes panel"| node_panel_build
node_panel_store -.->|"supplies panel"| node_eod
node_eod -->|"trains and predicts"| node_xgb
node_eod -->|"fits VAR"| node_var
node_eod -->|"builds output"| node_snapshots
node_fastapi -->|"exposes backtests"| node_backtest
node_fastapi -->|"exposes prices"| node_watchlist_prices
node_fastapi -.->|"serves analysis"| node_agents
node_agents -.->|"returns analysis"| node_fastapi
node_assistant -.->|"serves chat"| node_fastapi
node_fastapi -->|"serves dashboard"| node_react
node_fastapi -.->|"serves news"| node_news
node_fastapi -.->|"serves investing"| node_guided
node_guided -->|"applies policies"| node_guided_rules
node_fastapi -.->|"serves health"| node_financial_health
node_fastapi -.->|"serves goals"| node_goals
node_fastapi -.->|"serves onboarding"| node_home_onboarding
node_fastapi -.->|"serves learning"| node_learning
node_fastapi -.->|"serves community"| node_community
node_fastapi -.->|"serves Pro Lab"| node_pro_lab
node_pro_lab -->|"selects providers"| node_pro_lab_providers
node_community -->|"uses safety"| node_trust
node_guided -->|"reads runtime content"| node_admin_cms
node_admin_cms -->|"reads repository"| node_admin_cms_db
node_trust -->|"persists audit"| node_trust_db
node_analytics -->|"stores events"| node_analytics_db
node_guided -->|"emits events"| node_analytics
node_pro_lab -->|"emits events"| node_analytics
node_fastapi -.->|"uses app state"| node_app_state

click node_react "https://github.com/thangvawn/agent_financial/blob/version1/frontend/src/App.jsx"
click node_routes "https://github.com/thangvawn/agent_financial/blob/version1/frontend/src/app/domainRoutes.js"
click node_fastapi "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/api/main.py"
click node_ingest_cli "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/cli/ingest.py"
click node_panel_build "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/data/ingest.py"
click node_panel_store "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/platform/runtime/panel_store.py"
click node_watchlist_prices "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/data/watchlist_prices.py"
click node_eod "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/quant/eod_pipeline.py"
click node_xgb "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/quant/xgb_engine.py"
click node_var "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/quant/var_engine.py"
click node_backtest "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/quant/backtest.py"
click node_snapshots "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/schemas/snapshots.py"
click node_agents "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/agents/multi_agent.py"
click node_assistant "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/ai_assistant/application/services.py"
click node_news "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/news_intelligence/application/services.py"
click node_guided "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/guided_investing/application/services.py"
click node_guided_rules "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/guided_investing/domain/policies.py"
click node_financial_health "https://github.com/thangvawn/agent_financial/tree/version1/src/risk_dashboard/modules/financial_health"
click node_goals "https://github.com/thangvawn/agent_financial/tree/version1/src/risk_dashboard/modules/goals"
click node_home_onboarding "https://github.com/thangvawn/agent_financial/tree/version1/src/risk_dashboard/modules/home_onboarding"
click node_learning "https://github.com/thangvawn/agent_financial/tree/version1/src/risk_dashboard/modules/learning"
click node_community "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/community/application/services.py"
click node_pro_lab "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/pro_lab/application/services.py"
click node_pro_lab_providers "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/pro_lab/providers/registry.py"
click node_admin_cms "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/admin_cms/application/runtime_reader.py"
click node_admin_cms_db "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/admin_cms/infrastructure/repositories/sqlite.py"
click node_trust "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/trust_safety/application/services.py"
click node_trust_db "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/trust_safety/infrastructure/repositories/sqlite.py"
click node_analytics "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/analytics_monitoring/application/emitter.py"
click node_analytics_db "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/analytics_monitoring/infrastructure/repositories/sqlite.py"
click node_app_state "https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/platform/database/app_state.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_react,node_routes,node_fastapi,node_user toneBlue
class node_ingest_cli,node_panel_build,node_panel_store,node_watchlist_prices,node_eod,node_xgb,node_var,node_backtest,node_snapshots toneAmber
class node_agents,node_assistant,node_news toneMint
class node_guided,node_guided_rules,node_financial_health,node_goals,node_home_onboarding,node_learning,node_community,node_pro_lab,node_pro_lab_providers toneRose
class node_admin_cms,node_admin_cms_db,node_trust,node_trust_db,node_analytics,node_analytics_db,node_app_state toneIndigo
```

## Components

### Dashboard experience

- [React application](https://github.com/thangvawn/agent_financial/blob/version1/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Product routes](https://github.com/thangvawn/agent_financial/blob/version1/frontend/src/app/domainRoutes.js): `frontend/src/app/domainRoutes.js`
- [FastAPI service](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/api/main.py): `src/risk_dashboard/api/main.py`

### Market data and quant

- [Data ingestion CLI](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/cli/ingest.py): `src/risk_dashboard/cli/ingest.py`
- [Panel construction](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/data/ingest.py): `src/risk_dashboard/data/ingest.py`
- [Panel runtime store](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/platform/runtime/panel_store.py): `src/risk_dashboard/platform/runtime/panel_store.py`
- [Watchlist prices](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/data/watchlist_prices.py): `src/risk_dashboard/data/watchlist_prices.py`
- [EOD quant pipeline](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/quant/eod_pipeline.py): `src/risk_dashboard/quant/eod_pipeline.py`
- [Risk model](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/quant/xgb_engine.py): `src/risk_dashboard/quant/xgb_engine.py`
- [VAR analysis](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/quant/var_engine.py): `src/risk_dashboard/quant/var_engine.py`
- [Portfolio backtests](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/quant/backtest.py): `src/risk_dashboard/quant/backtest.py`
- [Risk snapshots](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/schemas/snapshots.py): `src/risk_dashboard/schemas/snapshots.py`

### Analysis and assistant

- [Multi-agent analysis](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/agents/multi_agent.py): `src/risk_dashboard/agents/multi_agent.py`
- [AI assistant](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/ai_assistant/application/services.py): `src/risk_dashboard/modules/ai_assistant/application/services.py`
- [News intelligence](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/news_intelligence/application/services.py): `src/risk_dashboard/modules/news_intelligence/application/services.py`

### User products

- [Guided investing](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/guided_investing/application/services.py): `src/risk_dashboard/modules/guided_investing/application/services.py`
- [Investing policies](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/guided_investing/domain/policies.py): `src/risk_dashboard/modules/guided_investing/domain/policies.py`
- [Financial health](https://github.com/thangvawn/agent_financial/tree/version1/src/risk_dashboard/modules/financial_health): `src/risk_dashboard/modules/financial_health`
- [Goals](https://github.com/thangvawn/agent_financial/tree/version1/src/risk_dashboard/modules/goals): `src/risk_dashboard/modules/goals`
- [Home and onboarding](https://github.com/thangvawn/agent_financial/tree/version1/src/risk_dashboard/modules/home_onboarding): `src/risk_dashboard/modules/home_onboarding`
- [Learning](https://github.com/thangvawn/agent_financial/tree/version1/src/risk_dashboard/modules/learning): `src/risk_dashboard/modules/learning`
- [Community](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/community/application/services.py): `src/risk_dashboard/modules/community/application/services.py`
- [Pro Lab](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/pro_lab/application/services.py): `src/risk_dashboard/modules/pro_lab/application/services.py`
- [Provider registry](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/pro_lab/providers/registry.py): `src/risk_dashboard/modules/pro_lab/providers/registry.py`

### Administration and safety

- [Content operations](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/admin_cms/application/runtime_reader.py): `src/risk_dashboard/modules/admin_cms/application/runtime_reader.py`
- [Content repository](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/admin_cms/infrastructure/repositories/sqlite.py): `src/risk_dashboard/modules/admin_cms/infrastructure/repositories/sqlite.py`
- [Trust and safety](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/trust_safety/application/services.py): `src/risk_dashboard/modules/trust_safety/application/services.py`
- [Trust repository](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/trust_safety/infrastructure/repositories/sqlite.py): `src/risk_dashboard/modules/trust_safety/infrastructure/repositories/sqlite.py`
- [Product analytics](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/analytics_monitoring/application/emitter.py): `src/risk_dashboard/modules/analytics_monitoring/application/emitter.py`
- [Analytics repository](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/modules/analytics_monitoring/infrastructure/repositories/sqlite.py): `src/risk_dashboard/modules/analytics_monitoring/infrastructure/repositories/sqlite.py`
- [Application state DB](https://github.com/thangvawn/agent_financial/blob/version1/src/risk_dashboard/platform/database/app_state.py): `src/risk_dashboard/platform/database/app_state.py`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → React application: uses (evidence: `README.md`)
- React application → Product routes: resolves routes (evidence: `frontend/src/App.jsx`)
- React application → FastAPI service: requests data
- FastAPI service → Panel runtime store: loads panel (evidence: `src/risk_dashboard/api/main.py`)
- Data ingestion CLI → Panel construction: runs ingestion (evidence: `src/risk_dashboard/cli/ingest.py`)
- Data ingestion CLI → Panel construction: writes panel (evidence: `src/risk_dashboard/data/ingest.py`)
- Panel runtime store → EOD quant pipeline: supplies panel
- EOD quant pipeline → Risk model: trains and predicts (evidence: `src/risk_dashboard/quant/eod_pipeline.py`)
- EOD quant pipeline → VAR analysis: fits VAR (evidence: `src/risk_dashboard/quant/eod_pipeline.py`)
- EOD quant pipeline → Risk snapshots: builds output (evidence: `src/risk_dashboard/quant/eod_pipeline.py`)
- FastAPI service → Portfolio backtests: exposes backtests (evidence: `src/risk_dashboard/api/main.py`)
- FastAPI service → Watchlist prices: exposes prices (evidence: `src/risk_dashboard/api/main.py`)
- FastAPI service → Multi-agent analysis: serves analysis
- Multi-agent analysis → FastAPI service: returns analysis (evidence: `README.md`)
- AI assistant → FastAPI service: serves chat (evidence: `README.md`)
- FastAPI service → React application: serves dashboard (evidence: `README.md`)
- FastAPI service → News intelligence: serves news (evidence: `README.md`)
- FastAPI service → Guided investing: serves investing (evidence: `README.md`)
- Guided investing → Investing policies: applies policies (evidence: `src/risk_dashboard/modules/guided_investing/application/services.py`)
- FastAPI service → Financial health: serves health (evidence: `README.md`)
- FastAPI service → Goals: serves goals (evidence: `README.md`)
- FastAPI service → Home and onboarding: serves onboarding (evidence: `README.md`)
- FastAPI service → Learning: serves learning (evidence: `README.md`)
- FastAPI service → Community: serves community (evidence: `README.md`)
- FastAPI service → Pro Lab: serves Pro Lab (evidence: `README.md`)
- Pro Lab → Provider registry: selects providers (evidence: `src/risk_dashboard/modules/pro_lab/application/services.py`)
- Community → Trust and safety: uses safety (evidence: `src/risk_dashboard/modules/community/application/services.py`)
- Guided investing → Content operations: reads runtime content (evidence: `src/risk_dashboard/modules/guided_investing/application/services.py`)
- Content operations → Content repository: reads repository (evidence: `src/risk_dashboard/modules/admin_cms/application/runtime_reader.py`)
- Trust and safety → Trust repository: persists audit (evidence: `src/risk_dashboard/modules/trust_safety/application/services.py`)
- Product analytics → Analytics repository: stores events (evidence: `src/risk_dashboard/modules/analytics_monitoring/application/emitter.py`)
- Guided investing → Product analytics: emits events (evidence: `src/risk_dashboard/modules/guided_investing/application/services.py`)
- Pro Lab → Product analytics: emits events (evidence: `src/risk_dashboard/modules/pro_lab/application/services.py`)
- FastAPI service → Application state DB: uses app state
