A Python library that wraps many Chinese and global financial data sources into simple, one-line data-fetching functions.
fasiondog/hikyuu
An open-source C++/Python quantitative trading framework for strategy research, portfolio construction and backtesting on A-share data.
- Stars
- 3,688
- Forks
- 861
- Open issues
- 5
- Last commit
- yesterday
Repolode describes open-source projects and does not give investment advice. Trading and investing can lose money: assess the risk yourself and follow the laws where you live before using this project.
What is it?
Hikyuu is a quantitative research framework whose core is written in C++ with a Python interface. It splits a trading strategy into explicit parts such as market environment, condition, signal, position sizing, stop-loss, take-profit and slippage, so each part can be replaced and tested on its own.
Portfolios are modeled as strategies themselves. A portfolio node can hold sub-systems, and sub-systems can be nested to any depth. The framework offers three run modes: signal aggregation, fund allocation with sub-manager autonomy, and a shared account where sub-systems trade directly. Trades are recorded in a ledger with itemized costs, delayed fills and handling for ex-rights and ex-dividend events.
Hikyuu imports China A-share historical data through its bundled importer, and stores data in HDF5, MySQL, ClickHouse or SQLite. The project states it is for study and research only and does not provide a trading service; order execution is left to a pluggable OrderBroker interface.
Key features
- 01Strategy parts (EV, CN, SG, MM, ST, TP, PG, SP) are separate, replaceable objects.
- 02Portfolios and strategies share one structure and can be nested arbitrarily deep.
- 03Three portfolio run modes: signal aggregation, fund allocation and shared account.
- 04Itemized trading costs, delayed fills and equity adjustments for ex-rights events.
- 05Built-in walk-forward optimization through SYS_WalkForward.
- 06Storage backends include HDF5, MySQL, ClickHouse and SQLite.
Use cases
- Studying systematic trading methods with a structured strategy framework.
- Backtesting a single strategy on China A-share daily data with itemized costs.
- Combining several strategies or instrument-level systems into one portfolio for allocation tests.
- Building custom quantitative tools in C++ on the standalone core library.
Quick start
- 1
Install the package from PyPI
pip install hikyuu - 2
Import A-share market data using the graphical interface (generates the configuration file)
HikyuuTDX - 3
Run the first backtest in Python using the interactive module
Things to know
- Downloads China A-share data only; overseas markets are not yet supported.
- Not an automated trading or order execution system; broker connectivity is left to the user.
- Official Python packages cover only Python 3.10 to 3.13, and Linux requires Ubuntu 24.04 or newer.
Topics
FAQ
- What is hikyuu?
- An open-source C++/Python quantitative trading framework for strategy research, portfolio construction and backtesting on A-share data. Hikyuu is a quantitative research framework whose core is written in C++ with a Python interface. It splits a trading strategy into explicit parts such as market environment, condition, signal, position sizing, stop-loss, take-profit and slippage, so each part can be replaced and tested on its own.
- Is hikyuu free to use? What license does it have?
- hikyuu is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is hikyuu still maintained?
- Actively maintained. The last commit to hikyuu was on Nov 6, 2026.
- What can I use hikyuu for?
- Studying systematic trading methods with a structured strategy framework. Backtesting a single strategy on China A-share daily data with itemized costs. Combining several strategies or instrument-level systems into one portfolio for allocation tests. Building custom quantitative tools in C++ on the standalone core library.
- How do I install hikyuu?
- Install the package from PyPI: pip install hikyuu Import A-share market data using the graphical interface (generates the configuration file): HikyuuTDX Run the first backtest in Python using the interactive module
- Where can I get hikyuu?
- The source code and installation instructions are on GitHub: https://github.com/fasiondog/hikyuu
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Pure-local Python quant trading framework covering stock, futures and options data, backtesting, simulated and live trading, and multi-account management.
A Python package implementing Chan Zhongshuo (缠论) technical analysis for stocks, futures and crypto, with a Rust core for fractal, stroke and pivot detection.
An educational proof of concept that uses multiple LLM-powered investor agents to explore AI-driven trading decisions; it does not execute trades.
Open-source multi-agent LLM framework that simulates a trading firm, with analyst, researcher, trader and risk agents debating market decisions.
A lightweight Python framework for building and running CTP-based futures trading strategies, with live trading and backtesting.