# Hikyuu: a C++/Python quant framework for A-share research and backtesting

> Hikyuu wraps a C++ calculation core in a Python layer and an interactive exploration tool, aimed at systematic trading research on Chinese A-share data. Its modular strategy components and four storage backends are the main draw; the documentation and the ecosystem are Chinese-first, and the framework ships no broker connectivity.

**fasiondog/hikyuu** — Hikyuu Quant Framework 基于C++/Python的超高速开源量化交易研究框架，同时可基于策略部件进行资产重用，快速累积策略资产。

- Repository: https://github.com/fasiondog/hikyuu
- Website: http://hikyuu.org/
- Stars: 3,536 · Forks: 835
- Language: C++
- License: Apache-2.0
- Published: 2026-09-23 · Updated: 2026-09-23 · Language: en
- Canonical page: https://hysenlabs.com/projects/fasiondog-hikyuu

## What Hikyuu solves, and for whom

Hikyuu is a quant research framework built around Chinese A-share market data. The README describes it as a C++/Python framework focused on strategy analysis, backtesting and extension toward live trading, and it splits a systematic trading method into separate parts: market environment judgement, system validity conditions, signal indicators, stop-loss and take-profit rules, money management, profit targets, slippage algorithms, trading-object selection and capital allocation. The intended user is someone who wants to assemble those parts into a personal strategy library and test combinations, rather than write one monolithic backtest script.

The scope is narrower than a general-purpose trading library. The README states that the project is a research tool for personal study, academic research and data analysis, that it does not constitute investment advice, and that it neither provides nor bundles securities trading services. If your data is US equities, crypto or futures outside the A-share conventions the framework assumes, the built-in data import path is not aimed at you.

## The three-layer architecture and where the speed comes from

The repository is organised into three visible pieces: hikyuu_cpp, the C++ core library; hikyuu_pywrap, the Python binding layer; and the hikyuu Python package with its interactive module. The README describes the C++ core as carrying the full strategy framework with native multithreading and multicore support, and as usable on its own to build custom quant tools. The Python layer wraps that core, integrates TA-Lib, and converts to and from numpy and pandas.

The performance claim in the README is specific: on an AMD 7950x, summing a 20-day moving average over 19.13 million A-share daily bars takes about 6 seconds on first load and compute, and about 166 milliseconds once the data is warm. Those are the project's own published numbers, not an independent measurement. The mechanism behind the gap is data caching: the first pass reads and converts, later passes reuse the loaded series. The build system is xmake, not cmake, which matters if you plan to compile from source rather than install a wheel.

Storage is pluggable. The README lists HDF5, MySQL, ClickHouse and SQLite, with HDF5 as the default because files are small and fast to read and back up. It gives file sizes as of 2017-04-21: 149MB for Shanghai daily data, 184MB for Shenzhen, and under 2GB for 5-minute bars. ClickHouse is offered as a plugin and is described as faster to read and write than HDF5 and far smaller than MySQL, which makes it the more sensible choice for minute-level or finer data.

## Installing Hikyuu and running a first backtest

The README requires Python 3.10 or newer; it states that 3.9 and below no longer support pip installation as of 2.8.0. Windows, Linux and macOS are supported, with Ubuntu 24.04 or newer on the Linux side. Dependencies such as numpy>=2.0, pandas>=2.3.0, matplotlib>=3.5.0, PySide6>=6.8.0 and tables>=3.9.0 are installed automatically. The install itself is one command:

```bash
pip install hikyuu
```

If the download stalls, the README suggests a mirror:

```bash
pip install hikyuu -i https://pypi.tuna.tsinghua.edu.cn/simple
```

Before any backtest you need market data. The README gives two routes. HikyuuTDX opens a graphical importer and generates the configuration file on first run; importdata is the command-line equivalent and requires that configuration to exist already:

```bash
HikyuuTDX
importdata
```

The first backtest is short. The example creates a simulated account with 300,000 in initial cash, a signal indicator built from a 5-day EMA whose own 10-day EMA acts as the slow line, and a fixed position size of 1,000 shares per buy. The system runs over roughly the last 150 bars of Ping An Bank:

```python
from hikyuu.interactive import *

my_tm = crtTM(init_cash=300000)
my_sg = SG_Flex(EMA(CLOSE(), n=5), slow_n=10)
my_mm = MM_FixedCount(1000)

sys = SYS_Simple(tm=my_tm, sg=my_sg, mm=my_mm)
sys.run(sm['sz000001'], Query(-150))
```

The README notes that the full walkthrough lives in the Jupyter notebook series linked from the project page, so treat this snippet as a smoke test rather than a template.

## Where Hikyuu gets in the way

The README's own troubleshooting table is the clearest list of failure modes. On Windows, pip install can hang while downloading PyQt or PySide6; the documented fix is the Tsinghua mirror. The HikyuuTDX graphical importer can fail to import data, in which case the README points to the importdata command line, which in turn needs the GUI to have run once to produce its configuration file. Errors about missing hdf5 or dll files are answered with pip install tables to reinstall HDF5 support. And anyone building from source needs xmake, not cmake, a detail that trips up people who assume the usual C++ toolchain.

The larger limitation is that the repository does not document rollback or downgrade procedures. There is no statement about what happens to an existing HDF5 data directory when a new release changes the schema, and no migration guide is provided. Treat that as unknown rather than safe. The framework also does not ship a broker connection: the README says it offers generic extension interfaces and recommends connecting only to licensed, compliant trading terminals, with QMT named as an example, and places all risk and legal responsibility for any such integration on the user. If you need working live execution out of the box, this is the wrong tool.

## How Hikyuu differs from Backtrader and Zipline

Backtrader and Zipline are the usual comparisons for Python backtesting, and the difference is in the split between engine and data layer. Backtrader is pure Python and expects you to feed it data through its own data feed classes; Hikyuu puts the calculation core in C++ and ships its own importers and storage backends, so the framework owns the path from raw A-share files to cached series. That is why the README can quote a warm-cache figure of 166 milliseconds over 19.13 million bars: the data is already in HDF5 or ClickHouse in a format the core understands.

Zipline is built around a pipeline and bundle model oriented to US equities, and its data ingestion is a separate project. Hikyuu's component vocabulary (environment, validity conditions, signal, stop-loss, money management, slippage) is closer to a systematic trading checklist than to a pipeline abstraction, and the README presents it as a way to accumulate reusable strategy assets across projects. The trade-off is portability: a Backtrader strategy is ordinary Python and moves easily, while Hikyuu strategy code is bound to its component classes and its A-share data conventions.

## Licence, maintenance and upgrade cost

Hikyuu is released under Apache-2.0, and the README frames that as transparency plus local control of data and strategies, with the C++ core separable for building custom clients. Apache-2.0 permits commercial use and modification and includes a patent grant; it also requires that you keep the licence and notice files with any redistribution. That is a description of the licence text, not legal advice, and if you plan to redistribute a modified core you should read the terms yourself.

The repository is not archived, and the last push was on 2026-09-23. Releases are frequent: 2.8.0 on 2026-06-10, 2.8.1 on 2026-07-09 and 2.8.2 on 2026-08-20. Frequent releases cut both ways. Bug fixes arrive quickly, but each minor version is a chance that a data format or an API detail shifts, and because the repository documents no rollback path, pinning a version in your own environment is the only lever available. The dependency list is long, including PySide6, tables, clickhouse-connect, akshare and pynng, so a fresh install pulls a substantial stack and the GUI components are not optional if you use HikyuuTDX.

## Running it as a self-hosted research setup

The README describes one deployment pattern worth noting: Python plus Jupyter on a cloud server, accessed from phone, tablet or desktop, with numpy, scipy, pandas and TensorFlow available alongside. Nothing in the README describes a hosted service, so this is a self-managed arrangement where you own the machine, the data directory and the storage backend choice. The default HDF5 backend keeps everything in local files, which makes backup a file copy and makes the data easy to move between machines. Choosing ClickHouse instead means running a separate server, which the README justifies on read/write speed and space for minute-level data.

There is no documented authentication, multi-user separation or API surface for serving strategies to other people. If you want a platform rather than a workstation, you are building that layer yourself on top of the Python package.

## Conclusion

Adopt Hikyuu if you research systematic strategies on Chinese A-share data and want a Python-facing API over a C++ core with pluggable storage. Do not adopt it if you need a ready-made broker connection, documented rollback and upgrade procedures, or English-language documentation, since the homepage and help docs are Chinese and the framework only offers extension hooks for third-party trading terminals. Before committing, run pip install hikyuu, import data with HikyuuTDX or importdata, and confirm that the storage backend you intend to use is the default HDF5 or one you configure yourself.

## FAQ

### What Python version does Hikyuu require?

The README requires Python 3.10 or newer and states that 3.9 and below no longer support pip installation as of release 2.8.0. Windows, Linux (Ubuntu 24.04+) and macOS are supported.

### How do I install Hikyuu?

Run pip install hikyuu. The README suggests pip install hikyuu -i https://pypi.tuna.tsinghua.edu.cn/simple if the download is slow, and notes that dependencies such as numpy, pandas, matplotlib, PySide6 and tables are installed automatically.

### Which storage backends does Hikyuu support for market data?

The README lists HDF5, MySQL, ClickHouse and SQLite, with HDF5 as the default. ClickHouse is available through a plugin and is described as faster to read and write than HDF5 and far smaller than MySQL, which suits minute-level data.

### Does Hikyuu include live trading or broker connectivity?

No. The README states that the project provides no securities trading service and only offers generic extension interfaces, recommending connection to licensed compliant terminals such as QMT, with all risk and legal responsibility on the user.

## Sources

- [fasiondog/hikyuu on GitHub](https://github.com/fasiondog/hikyuu)
- [License: Apache-2.0](https://github.com/fasiondog/hikyuu/blob/master/LICENSE)
- [Project website](http://hikyuu.org/)
- [README](https://github.com/fasiondog/hikyuu/blob/master/README.md)
- [Releases](https://github.com/fasiondog/hikyuu/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/fasiondog-hikyuu
