Framework
ricequant/rqalpha avatar
ricequant/rqalpha

RQAlpha assembles a backtest from seven sys_ mods, and its licence stops short of Apache 2.0

A extendable, replaceable Python algorithmic backtest && trading framework supporting multiple securities

6,893 stars1,803 forksPythonNOASSERTION

At a glance

What is it?
An extendable Python framework where the matching engine, the risk checks and the transaction costs are all plugins rather than core code, aimed at Chinese A-share strategies. The data it backtests against is not in the repository, and the licence header is narrower than the packaging metadata says.
Who is it for?
RQAlpha fits a team writing Chinese A-share strategies that already subscribes to RQData and wants the matching engine, the risk checks and the fee maths to be replaceable plugins. It does not fit anyone who needs an English interface, or an unambiguous open-source licence, since the licence header overrides the Apache 2.0 declared in `pyproject.toml`.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 28 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • ricequant/rqalpha6,893 ★ · +100
Star history
Repository2026-09-232026-11-24
ricequant/rqalpha6.8k6.9k

100 Stars in the last 62 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

setup.py adds a non-commercial clause on top of Apache-2.0

Two licence statements sit side by side and they do not say the same thing. `pyproject.toml` declares `license = {text = "Apache-2.0"}` and names Apache-2.0 as the project licence, while the header comment in `setup.py` splits use into two cases. Non-commercial use, defined as personal study or work by universities and research institutes for education and research, is Apache 2.0 with the text shipped unchanged. Commercial use, defined as any commercial purpose by an individual or any purpose by a legal person or organisation, needs authorisation from the company behind the project, and where the two texts conflict the header wins.

The README repeats the restriction in one line and gives an address, [email protected], for commercial enquiries. The repository metadata itself reports no recognised licence identifier, so an index that trusts the metadata will not see the restriction at all. Anyone planning to run this inside a fund or a product needs that classification answered before the first commit.

One console script named rqalpha, versioned from git tags

`[project.scripts]` declares exactly one entry, `rqalpha = "rqalpha.__main__:entry_point"`, so every command the README shows comes from a single Python entry point. The version is not written down anywhere: `[project]` sets `dynamic = ["version"]` and the build requirements pull in `setuptools_scm[toml]`, which reads it from the git tag.

The tags follow a release branch convention: `release/6.5.0` on 2026-10-28, `release/6.4.2` on 2026-10-20 and `release/6.4.1` on 2026-10-09. The default branch is master, and a develop branch sits in the README's link list next to a TODO file, so the trunk you clone on sight is not obviously the one the next release is cut from.

sys_simulation supplies the matching engine and sys_risk checks orders before sending

The architecture is a set of mods carrying a `sys_` prefix, and the README's table of them is the clearest description of the framework on offer. `sys_simulation` provides the simulated matching engine and the backtest event source, which is what makes a run a backtest rather than a lookup table of prices. `sys_accounts` supplies the order APIs for stocks and futures plus the position model. `sys_risk` validates an order before it goes out. `sys_transaction_cost` computes the tax and fee side of a fill, `sys_progress` prints progress to the console, and `sys_analyser` records orders, trades, portfolio and positions per day, computes risk indicators, and writes the output as csv or plots.

The consequence is that risk checks and cost maths are not baked into the core loop. That is convenient for a strategy written against Chinese A-share fees and awkward for anyone expecting a different fee schedule to be standard.

rqalpha mod list, enable and disable are the whole extension surface

Extensions are managed with three subcommands:

bash
rqalpha mod list
rqalpha mod enable xxx
rqalpha mod disable xxx

The interface is small. The README calls this the Mod Hook interface and gives its purpose as connecting third-party libraries, with a separate repository holding a Tushare mod as the worked example. If you write one, the project says to tell them, and after review your mod gets named and linked in the list, which puts a human review queue in front of a public registry.

What the interface does not show is a version constraint or a dependency check. Nothing on that page says what happens when a mod needs a different version of another `sys_` mod than the one you enabled.

Installation is a readthedocs page, and Python 3.8 through 3.14 are declared

The README carries no install command. It links an installation guide hosted on readthedocs, plus a ten-minute tutorial, a set of strategy examples and an API manual, and it shows PyPI badges for the version and for supported Python releases. The concrete numbers are in the packaging metadata instead: `requires-python = ">=3.8"`, classifiers for 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14, and Operating System :: OS Independent.

So the install itself is:

bash
pip install rqalpha

The first thing worth doing afterwards is to look at which mods arrived, because the `sys_` set is what turns a bare run into a backtest. Profiling is an extra rather than a default: it is declared as `line_profiler` under the `profiler` optional group, and the repository root also holds a `performance/` directory.

numpy is pinned twice, below 2.0 on 3.11 and 2.0 or later on 3.12

`numpy` appears twice in the dependency list with opposite bounds: `numpy < 2.0.0; python_version <= "3.11"` and `numpy >=2.0.0; python_version >= "3.12"`. A project claiming seven Python versions has to straddle the NumPy 2.0 boundary, and it does it with environment markers rather than by dropping the older interpreters.

`pandas >=1.0.5, <4.0.0` is the other wide range. Most of the rest carry no bound at all: `requests`, `python-dateutil`, `logbook`, `jsonpickle`, `simplejson`, `PyYAML`, `tabulate`, `h5py`, `hdf5plugin`, `openpyxl`, `methodtools` and `filelock` are named bare. Four have a floor, `click >=7.0.0`, `rqrisk >=1.0.10`, `matplotlib >=3.1.0` and `typing-extensions >=4.5.0`. `rqrisk` is a separate distribution the framework depends on, and `h5py` with `hdf5plugin` is the only HDF5 pair in the list.

RQData is a paid service, and none of it lives in this repository

The data side is not in the tree. The README gives its longest section to RQData, a commercial financial data service from the same company, and describes a dozen data families running from Chinese A-share contract information and corporate actions through to point-in-time financials, style factor exposures updated from 8:30 each trading day, and sentiment data from two retail forums. The integration point is a single import: `rqdatac`, called from inside the strategy.

That split is the thing to weigh before choosing the framework. The matching engine, the risk mods, the fee logic and the analyser are here, under a licence with a non-commercial clause. The prices, dividends, suspensions and ST flags that make an A-share backtest mean anything are a subscription with Python, Matlab and Excel interfaces. A strategy written against `rqdatac` will not run from this repository alone.

A Chinese README and one zh_Hans_CN message catalogue in the package data

The README is written in Chinese, and so is the documentation site it links, which serves the zh_CN build. The code carries the same bias more structurally: the package data list includes `utils/translations/zh_Hans_CN/LC_MESSAGES/*`, and the root holds `babel.cfg` and `messages.pot` for gettext extraction.

The rest of the root is the usual Python layout with two extras worth naming. `.travis.yml` sits beside `.readthedocs.yml` (the README's CI badge points at a GitHub Actions Test workflow), and `.coveragerc` sits beside `tests/` and `docs/`. A `CLAUDE.md` at the root means the repository also carries instructions for an assistant.

Editorial conclusion

RQAlpha fits a team writing Chinese A-share strategies that already subscribes to RQData and wants the matching engine, the risk checks and the fee maths to be replaceable plugins. It does not fit anyone who needs an English interface, or an unambiguous open-source licence, since the licence header overrides the Apache 2.0 declared in `pyproject.toml`. Before installing, confirm in writing with [email protected] how your intended use is classified, then run `rqalpha mod list` to see which of the seven sys_ mods came with the release.

Frequently asked questions

What is RQAlpha used for?

It covers the algorithmic trading pipeline from data fetching through the backtest engine and live simulation to analysis, so a strategy can be written once and run against history. It is aimed at programmatic traders rather than at people who want a charting terminal.

Is RQAlpha free for commercial use?

No. The README restricts it to non-commercial use and asks commercial users to contact [email protected]. The `setup.py` header says the same thing more precisely: Apache 2.0 for non-commercial use, authorisation from the company for commercial use, and the header wins where the two conflict.

How do I add a third-party library to RQAlpha?

Through the Mod Hook interface. `rqalpha mod list` shows the installed mods and their status, `rqalpha mod enable xxx` and `rqalpha mod disable xxx` turn one on or off, and a Tushare mod is kept in its own repository as the example.

Which Python versions does RQAlpha support?

The packaging metadata sets `requires-python = ">=3.8"` and lists classifiers from 3.8 through 3.14. NumPy is bounded differently on each side of 3.12, below 2.0 on 3.11 and earlier, 2.0 or later from 3.12.

Where does RQAlpha get its market data?

Not from this repository. RQData is a separate commercial service from the same company, and a strategy pulls from it by importing `rqdatac`. Seven sys_ mods ship with the framework, but no price history is bundled.

Official sources

  1. Issues
  2. Project website
  3. README
  4. Releases
  5. ricequant/rqalpha on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/ricequant-rqalpha.svg)](https://hysenlabs.com/projects/ricequant-rqalpha)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/ricequant-rqalpha.svg)](https://hysenlabs.com/projects/ricequant-rqalpha)

Was this useful?