# fasiondog/hikyuu architecture

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

- Interactive diagram: https://gitdiagram.com/fasiondog/hikyuu
- Repository: https://github.com/fasiondog/hikyuu

## Overview

Hikyuu is a C++/Python quantitative-trading research framework. The documented user workflow is to import A-share market data, load it into the framework, compose indicators and trading-system parts, run a backtest, and inspect the results. Its major supporting capabilities include multiple storage backends, data-fetching/import tools, analysis, plotting, and extensible strategy components. The README establishes the user workflow; source excerpts and index references support only selected internal links, so uncertain connections are omitted.

Main entry points: [`hikyuu/strategy`](https://github.com/fasiondog/hikyuu/tree/master/hikyuu/strategy) (Trading systems), [`hikyuu/data/pytdx_to_clickhouse.py`](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/data/pytdx_to_clickhouse.py) (Data importers), [`hikyuu_cpp/hikyuu/StockManager.cpp`](https://github.com/fasiondog/hikyuu/blob/master/hikyuu_cpp/hikyuu/StockManager.cpp) (Stock data), [`hikyuu/__init__.py`](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/__init__.py) (Python API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Market data"]
  node_importers["Data importers"]
  node_fetchers["Market fetchers"]
  node_config["Data configuration"]
  node_storage[("Market storage")]
end

subgraph group_engine["Quant engine"]
  node_stock_data["Stock data<br/>[StockManager.cpp]"]
  node_indicators["Indicators"]
  node_strategy_system["Trading systems"]
  node_trade_manager["Trade manager<br/>[TradeManager.cpp]"]
end

subgraph group_research["Research tools"]
  node_analysis["Backtest analysis<br/>[analysis.py]"]
  node_plotting["Result plotting<br/>[matplotlib_draw.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_gui_import["GUI import<br/>[HikyuuTDX.py]"]
  node_cli_import["CLI import<br/>[common.py]"]
  node_python_api["Python API<br/>[__init__.py]"]
  node_interactive["Interactive tools<br/>[interactive.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"imports data"| node_gui_import
node_researcher -->|"imports data"| node_cli_import
node_gui_import -->|"starts import"| node_importers
node_importers -.->|"writes market data"| node_storage
node_fetchers -.->|"provides market data"| node_importers
node_python_api -->|"loads defaults"| node_config
node_python_api -.->|"initializes core"| node_stock_data
node_stock_data -->|"loads through drivers"| node_storage
node_researcher -->|"runs backtest"| node_interactive
node_interactive -->|"composes system"| node_strategy_system
node_strategy_system -.->|"uses signals"| node_indicators
node_strategy_system -.->|"runs trades"| node_trade_manager
node_researcher -->|"selects market data"| node_stock_data
node_researcher -.->|"reviews results"| node_analysis
node_researcher -.->|"views charts"| node_plotting

click node_gui_import "https://github.com/fasiondog/hikyuu/blob/master/hikyuu/gui/HikyuuTDX.py"
click node_cli_import "https://github.com/fasiondog/hikyuu/blob/master/hikyuu/data/common.py"
click node_importers "https://github.com/fasiondog/hikyuu/blob/master/hikyuu/data/pytdx_to_clickhouse.py"
click node_fetchers "https://github.com/fasiondog/hikyuu/tree/master/hikyuu/fetcher/stock"
click node_config "https://github.com/fasiondog/hikyuu/blob/master/hikyuu/data/hku_config_template.py"
click node_storage "https://github.com/fasiondog/hikyuu/tree/master/hikyuu_cpp/hikyuu/data_driver"
click node_stock_data "https://github.com/fasiondog/hikyuu/blob/master/hikyuu_cpp/hikyuu/StockManager.cpp"
click node_indicators "https://github.com/fasiondog/hikyuu/tree/master/hikyuu_cpp/hikyuu/indicator"
click node_strategy_system "https://github.com/fasiondog/hikyuu/tree/master/hikyuu/strategy"
click node_trade_manager "https://github.com/fasiondog/hikyuu/blob/master/hikyuu_cpp/hikyuu/trade_manage/TradeManager.cpp"
click node_analysis "https://github.com/fasiondog/hikyuu/blob/master/hikyuu/analysis/analysis.py"
click node_plotting "https://github.com/fasiondog/hikyuu/blob/master/hikyuu/draw/drawplot/matplotlib_draw.py"
click node_python_api "https://github.com/fasiondog/hikyuu/blob/master/hikyuu/__init__.py"
click node_interactive "https://github.com/fasiondog/hikyuu/blob/master/hikyuu/interactive.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_importers,node_fetchers,node_config,node_storage toneBlue
class node_stock_data,node_indicators,node_strategy_system,node_trade_manager toneAmber
class node_analysis,node_plotting toneMint
class node_gui_import,node_cli_import,node_python_api,node_interactive toneRose
class node_researcher toneIndigo
```

## Components

### Market data

- [Data importers](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/data/pytdx_to_clickhouse.py): `hikyuu/data/pytdx_to_clickhouse.py`
- [Market fetchers](https://github.com/fasiondog/hikyuu/tree/master/hikyuu/fetcher/stock): `hikyuu/fetcher/stock`
- [Data configuration](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/data/hku_config_template.py): `hikyuu/data/hku_config_template.py`
- [Market storage](https://github.com/fasiondog/hikyuu/tree/master/hikyuu_cpp/hikyuu/data_driver): `hikyuu_cpp/hikyuu/data_driver`

### Quant engine

- [Stock data](https://github.com/fasiondog/hikyuu/blob/master/hikyuu_cpp/hikyuu/StockManager.cpp): `hikyuu_cpp/hikyuu/StockManager.cpp`
- [Indicators](https://github.com/fasiondog/hikyuu/tree/master/hikyuu_cpp/hikyuu/indicator): `hikyuu_cpp/hikyuu/indicator`
- [Trading systems](https://github.com/fasiondog/hikyuu/tree/master/hikyuu/strategy): `hikyuu/strategy`
- [Trade manager](https://github.com/fasiondog/hikyuu/blob/master/hikyuu_cpp/hikyuu/trade_manage/TradeManager.cpp): `hikyuu_cpp/hikyuu/trade_manage/TradeManager.cpp`

### Research tools

- [Backtest analysis](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/analysis/analysis.py): `hikyuu/analysis/analysis.py`
- [Result plotting](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/draw/drawplot/matplotlib_draw.py): `hikyuu/draw/drawplot/matplotlib_draw.py`

### User interfaces

- [GUI import](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/gui/HikyuuTDX.py): `hikyuu/gui/HikyuuTDX.py`
- [CLI import](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/data/common.py): `hikyuu/data/common.py`
- [Python API](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/__init__.py): `hikyuu/__init__.py`
- [Interactive tools](https://github.com/fasiondog/hikyuu/blob/master/hikyuu/interactive.py): `hikyuu/interactive.py`

### Other components

- **Researcher**

## Connections

- Researcher → GUI import: imports data
- Researcher → CLI import: imports data
- GUI import → Data importers: starts import (evidence: `hikyuu/gui/HikyuuTDX.py`)
- Data importers → Market storage: writes market data
- Market fetchers → Data importers: provides market data
- Python API → Data configuration: loads defaults (evidence: `hikyuu/__init__.py`)
- Python API → Stock data: initializes core
- Stock data → Market storage: loads through drivers (evidence: `hikyuu_cpp/hikyuu/StockManager.cpp`)
- Researcher → Interactive tools: runs backtest
- Interactive tools → Trading systems: composes system
- Trading systems → Indicators: uses signals
- Trading systems → Trade manager: runs trades
- Researcher → Stock data: selects market data
- Researcher → Backtest analysis: reviews results
- Researcher → Result plotting: views charts
