# nnnightglow/replay architecture

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

- Interactive diagram: https://gitdiagram.com/nnnightglow/replay
- Repository: https://github.com/nnnightglow/replay

## Overview

A Vue 3 and Flask A-share market replay and analysis system. Users select a historical trading date, choose an analysis view, and receive market, index, sector, or stock results through the frontend API and Flask backend; chart components render visual output. Separate branches cover risk-oriented funds management and the evolving strategy-watch workflow, including resource conversion and agent support. The graph also includes the data-fetching, metadata, analysis, and visualization layers. Some backend routes and frontend views were not excerpted, so only documented or indexed relationships are shown.

Main entry points: [`frontend/src/router/index.js`](https://github.com/nnnightglow/replay/blob/master/frontend/src/router/index.js) (View routing), [`utils/data_fetcher.py`](https://github.com/nnnightglow/replay/blob/master/utils/data_fetcher.py) (Data access), [`frontend/src/services/api.js`](https://github.com/nnnightglow/replay/blob/master/frontend/src/services/api.js) (API client), [`utils/strategy_watch_api.py`](https://github.com/nnnightglow/replay/blob/master/utils/strategy_watch_api.py) (Strategy service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_router["View routing<br/>[index.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_index_view["Index analysis<br/>[IndexAnalysis.vue]"]
  node_sentiment_view["Market sentiment"]
  node_sector_view["Sector analysis<br/>[SectorAnalysis.vue]"]
  node_stocks_view["Strong stocks<br/>[BaimaAnalysis.vue]"]
  node_money_view["Money effect<br/>[MoneyEffect.vue]"]
  node_funds_view["Funds management"]
  node_strategy_view["Strategy watch<br/>[StrategyWatch.vue]"]
  node_chart["Chart renderer"]
end

subgraph group_backend["Analysis backend"]
  node_flask["HTTP API<br/>[flask_app.py]"]
  node_analysis["Market analysis<br/>[analyzer.py]"]
  node_visualizers["Chart generation"]
end

subgraph group_data["Market data"]
  node_fetcher["Data access<br/>[data_fetcher.py]"]
  node_stock_data[("Stock data")]
  node_index_data[("Index data")]
  node_market_data[("Market sentiment data")]
  node_sector_data[("Sector data")]
  node_calendar["Trading calendar"]
end

subgraph group_strategy["Strategy watch"]
  node_strategy_api["Strategy service"]
  node_agents["Agent runtime"]
  node_doc_conversion["Document conversion"]
  node_data_cache_skill["Cache inspection"]
  node_viz_skill["Visualization skill"]
end

node_investor(("Investor"))

node_investor -->|"selects view"| node_router
node_router -->|"routes to"| node_index_view
node_router -->|"routes to"| node_sentiment_view
node_router -->|"routes to"| node_sector_view
node_router -->|"routes to"| node_stocks_view
node_router -->|"routes to"| node_money_view
node_router -->|"routes to"| node_funds_view
node_router -->|"routes to"| node_strategy_view
node_index_view -.->|"requests data"| node_api_client
node_sentiment_view -.->|"requests data"| node_api_client
node_sector_view -->|"requests data"| node_api_client
node_stocks_view -->|"requests analysis"| node_api_client
node_money_view -.->|"requests data"| node_api_client
node_strategy_view -->|"requests strategy"| node_api_client
node_api_client -->|"HTTP requests"| node_flask
node_sector_view -->|"renders charts"| node_chart
node_strategy_view -->|"renders charts"| node_chart
node_flask -->|"dispatches analysis"| node_analysis
node_flask -->|"uses data access"| node_fetcher
node_analysis -->|"fetches data"| node_fetcher
node_analysis -->|"builds charts"| node_visualizers
node_fetcher -->|"uses manager"| node_stock_data
node_fetcher -->|"uses manager"| node_index_data
node_fetcher -->|"uses manager"| node_market_data
node_fetcher -->|"uses manager"| node_sector_data
node_fetcher -->|"checks dates"| node_calendar
node_flask -->|"dispatches strategy"| node_strategy_api
node_strategy_api -->|"uses agents"| node_agents
node_strategy_api -.->|"converts resources"| node_doc_conversion
node_strategy_api -.->|"inspects cache"| node_data_cache_skill
node_strategy_api -.->|"invokes visualization"| node_viz_skill

click node_router "https://github.com/nnnightglow/replay/blob/master/frontend/src/router/index.js"
click node_api_client "https://github.com/nnnightglow/replay/blob/master/frontend/src/services/api.js"
click node_index_view "https://github.com/nnnightglow/replay/blob/master/frontend/src/views/IndexAnalysis.vue"
click node_sentiment_view "https://github.com/nnnightglow/replay/blob/master/frontend/src/views/MarketSentiment.vue"
click node_sector_view "https://github.com/nnnightglow/replay/blob/master/frontend/src/views/SectorAnalysis.vue"
click node_stocks_view "https://github.com/nnnightglow/replay/blob/master/frontend/src/views/BaimaAnalysis.vue"
click node_money_view "https://github.com/nnnightglow/replay/blob/master/frontend/src/views/MoneyEffect.vue"
click node_funds_view "https://github.com/nnnightglow/replay/blob/master/frontend/src/views/FundsManagementPage.vue"
click node_strategy_view "https://github.com/nnnightglow/replay/blob/master/frontend/src/views/StrategyWatch.vue"
click node_chart "https://github.com/nnnightglow/replay/blob/master/frontend/src/components/EChartsRenderer.vue"
click node_flask "https://github.com/nnnightglow/replay/blob/master/flask_app.py"
click node_analysis "https://github.com/nnnightglow/replay/blob/master/utils/analyzer.py"
click node_visualizers "https://github.com/nnnightglow/replay/blob/master/utils/visualizers/index_visualizer.py"
click node_fetcher "https://github.com/nnnightglow/replay/blob/master/utils/data_fetcher.py"
click node_stock_data "https://github.com/nnnightglow/replay/blob/master/utils/metadata/stock_data_manager.py"
click node_index_data "https://github.com/nnnightglow/replay/blob/master/utils/metadata/index_data_manager.py"
click node_market_data "https://github.com/nnnightglow/replay/blob/master/utils/metadata/market_data_manager.py"
click node_sector_data "https://github.com/nnnightglow/replay/blob/master/utils/metadata/sector_data_manager.py"
click node_calendar "https://github.com/nnnightglow/replay/blob/master/utils/trading_calendar.py"
click node_strategy_api "https://github.com/nnnightglow/replay/blob/master/utils/strategy_watch_api.py"
click node_agents "https://github.com/nnnightglow/replay/blob/master/utils/agents/agentscope_runtime.py"
click node_doc_conversion "https://github.com/nnnightglow/replay/blob/master/skills/multiformat-to-md/scripts/multiformat_gateway.py"
click node_data_cache_skill "https://github.com/nnnightglow/replay/blob/master/skills/data-cache-inspector/scripts/data_cache_gateway.py"
click node_viz_skill "https://github.com/nnnightglow/replay/blob/master/skills/visualization/scripts/visualization_gateway.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_router,node_api_client,node_index_view,node_sentiment_view,node_sector_view,node_stocks_view,node_money_view,node_funds_view,node_strategy_view,node_chart toneBlue
class node_flask,node_analysis,node_visualizers toneAmber
class node_fetcher,node_stock_data,node_index_data,node_market_data,node_sector_data,node_calendar toneMint
class node_strategy_api,node_agents,node_doc_conversion,node_data_cache_skill,node_viz_skill toneRose
class node_investor toneIndigo
```

## Components

### Web client

- [View routing](https://github.com/nnnightglow/replay/blob/master/frontend/src/router/index.js): `frontend/src/router/index.js`
- [API client](https://github.com/nnnightglow/replay/blob/master/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Index analysis](https://github.com/nnnightglow/replay/blob/master/frontend/src/views/IndexAnalysis.vue): `frontend/src/views/IndexAnalysis.vue`
- [Market sentiment](https://github.com/nnnightglow/replay/blob/master/frontend/src/views/MarketSentiment.vue): `frontend/src/views/MarketSentiment.vue`
- [Sector analysis](https://github.com/nnnightglow/replay/blob/master/frontend/src/views/SectorAnalysis.vue): `frontend/src/views/SectorAnalysis.vue`
- [Strong stocks](https://github.com/nnnightglow/replay/blob/master/frontend/src/views/BaimaAnalysis.vue): `frontend/src/views/BaimaAnalysis.vue`
- [Money effect](https://github.com/nnnightglow/replay/blob/master/frontend/src/views/MoneyEffect.vue): `frontend/src/views/MoneyEffect.vue`
- [Funds management](https://github.com/nnnightglow/replay/blob/master/frontend/src/views/FundsManagementPage.vue): `frontend/src/views/FundsManagementPage.vue`
- [Strategy watch](https://github.com/nnnightglow/replay/blob/master/frontend/src/views/StrategyWatch.vue): `frontend/src/views/StrategyWatch.vue`
- [Chart renderer](https://github.com/nnnightglow/replay/blob/master/frontend/src/components/EChartsRenderer.vue): `frontend/src/components/EChartsRenderer.vue`

### Analysis backend

- [HTTP API](https://github.com/nnnightglow/replay/blob/master/flask_app.py): `flask_app.py`
- [Market analysis](https://github.com/nnnightglow/replay/blob/master/utils/analyzer.py): `utils/analyzer.py`
- [Chart generation](https://github.com/nnnightglow/replay/blob/master/utils/visualizers/index_visualizer.py): `utils/visualizers/index_visualizer.py`

### Market data

- [Data access](https://github.com/nnnightglow/replay/blob/master/utils/data_fetcher.py): `utils/data_fetcher.py`
- [Stock data](https://github.com/nnnightglow/replay/blob/master/utils/metadata/stock_data_manager.py): `utils/metadata/stock_data_manager.py`
- [Index data](https://github.com/nnnightglow/replay/blob/master/utils/metadata/index_data_manager.py): `utils/metadata/index_data_manager.py`
- [Market sentiment data](https://github.com/nnnightglow/replay/blob/master/utils/metadata/market_data_manager.py): `utils/metadata/market_data_manager.py`
- [Sector data](https://github.com/nnnightglow/replay/blob/master/utils/metadata/sector_data_manager.py): `utils/metadata/sector_data_manager.py`
- [Trading calendar](https://github.com/nnnightglow/replay/blob/master/utils/trading_calendar.py): `utils/trading_calendar.py`

### Strategy watch

- [Strategy service](https://github.com/nnnightglow/replay/blob/master/utils/strategy_watch_api.py): `utils/strategy_watch_api.py`
- [Agent runtime](https://github.com/nnnightglow/replay/blob/master/utils/agents/agentscope_runtime.py): `utils/agents/agentscope_runtime.py`
- [Document conversion](https://github.com/nnnightglow/replay/blob/master/skills/multiformat-to-md/scripts/multiformat_gateway.py): `skills/multiformat-to-md/scripts/multiformat_gateway.py`
- [Cache inspection](https://github.com/nnnightglow/replay/blob/master/skills/data-cache-inspector/scripts/data_cache_gateway.py): `skills/data-cache-inspector/scripts/data_cache_gateway.py`
- [Visualization skill](https://github.com/nnnightglow/replay/blob/master/skills/visualization/scripts/visualization_gateway.py): `skills/visualization/scripts/visualization_gateway.py`

### Other components

- **Investor**

## Connections

- Investor → View routing: selects view (evidence: `frontend/src/router/index.js`)
- View routing → Index analysis: routes to (evidence: `frontend/src/router/index.js`)
- View routing → Market sentiment: routes to (evidence: `frontend/src/router/index.js`)
- View routing → Sector analysis: routes to (evidence: `frontend/src/router/index.js`)
- View routing → Strong stocks: routes to (evidence: `frontend/src/router/index.js`)
- View routing → Money effect: routes to (evidence: `frontend/src/router/index.js`)
- View routing → Funds management: routes to (evidence: `frontend/src/router/index.js`)
- View routing → Strategy watch: routes to (evidence: `frontend/src/router/index.js`)
- Index analysis → API client: requests data
- Market sentiment → API client: requests data
- Sector analysis → API client: requests data (evidence: `frontend/src/views/SectorAnalysis.vue`)
- Strong stocks → API client: requests analysis (evidence: `frontend/src/views/BaimaAnalysis.vue`)
- Money effect → API client: requests data
- Strategy watch → API client: requests strategy (evidence: `frontend/src/views/StrategyWatch.vue`)
- API client → HTTP API: HTTP requests (evidence: `README.md`)
- Sector analysis → Chart renderer: renders charts (evidence: `frontend/src/views/SectorAnalysis.vue`)
- Strategy watch → Chart renderer: renders charts (evidence: `frontend/src/views/StrategyWatch.vue`)
- HTTP API → Market analysis: dispatches analysis (evidence: `flask_app.py`)
- HTTP API → Data access: uses data access (evidence: `flask_app.py`)
- Market analysis → Data access: fetches data (evidence: `utils/analyzer.py`)
- Market analysis → Chart generation: builds charts (evidence: `utils/analyzer.py`)
- Data access → Stock data: uses manager (evidence: `utils/data_fetcher.py`)
- Data access → Index data: uses manager (evidence: `utils/data_fetcher.py`)
- Data access → Market sentiment data: uses manager (evidence: `utils/data_fetcher.py`)
- Data access → Sector data: uses manager (evidence: `utils/data_fetcher.py`)
- Data access → Trading calendar: checks dates (evidence: `utils/data_fetcher.py`)
- HTTP API → Strategy service: dispatches strategy (evidence: `flask_app.py`)
- Strategy service → Agent runtime: uses agents (evidence: `utils/strategy_watch_api.py`)
- Strategy service → Document conversion: converts resources
- Strategy service → Cache inspection: inspects cache
- Strategy service → Visualization skill: invokes visualization
