# RQAlpha: a Python backtest and trading framework with a Mod-based core

> RQAlpha is Ricequant's Python framework for backtesting and trading Chinese equities and futures. Its Mod hook system and RQData integration define both what it does well and where it stops.

**ricequant/rqalpha** — A extendable, replaceable Python algorithmic backtest && trading framework supporting multiple securities

- Repository: https://github.com/ricequant/rqalpha
- Website: http://rqalpha.io
- Stars: 6,806 · Forks: 1,796
- Language: Python
- License: NOASSERTION
- Published: 2026-09-22 · Updated: 2026-09-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/ricequant-rqalpha

## The gap RQAlpha fills for Chinese market strategies

Most Python backtesting libraries assume US equities and a data source you wire up yourself. RQAlpha takes the opposite position. It is built for Chinese A-shares, futures, funds and convertible bonds, and it ships with a matching data path through RQData, Ricequant's commercial data service. The README states the scope plainly: from data acquisition and algorithmic trading through a backtest engine, live simulation and live trading to data analysis, it offers a full solution for programmatic traders. The intended user is a quant researcher or strategy developer working on Chinese markets who wants an event-driven engine rather than a vectorised one, and who is willing to accept a vendor relationship for data. That vendor relationship is not optional in practice. The README describes RQData as the local data service that plugs into RQAlpha, and says a strategy can import rqdatac to call contract information, A-share fundamentals, quotes back to 2005, fund data, futures and options data, convertible bonds, financial statements with point-in-time support, style factors and macroeconomic series. The framework itself is the engine; the data is a separate product.

## How the Mod hook system shapes the architecture

RQAlpha is not a monolith with a plugin folder bolted on. The core is deliberately thin and the behaviour lives in Mods, which are enabled or disabled at runtime. The README lists seven built-in Mods: sys_accounts for order APIs and position models across stocks and futures, sys_analyser for daily order, trade, portfolio and position records plus risk metrics exported to CSV or plots, sys_progress for console progress during a backtest, sys_risk for pre-trade order validation, sys_scheduler for timers that run logic on a fixed cycle, sys_simulation for the matching engine and backtest event source, and sys_transaction_cost for stock and futures fee and tax calculation. The README describes the interface as a Mod Hook that lets developers connect third-party libraries, and it invites external Mod authors to submit their work for listing. The practical consequence is that a backtest run is a composition. If sys_transaction_cost is off, your results have no fees. If sys_risk is off, nothing rejects a bad order before it reaches the matching engine. That is a real design choice with real consequences, and it means two people running the same strategy file can get different numbers depending on which Mods are active. The README does not document rollback behaviour or Mod version pinning, so if you depend on a specific Mod configuration, you are responsible for capturing it yourself.

## Installing RQAlpha and running a first backtest

The README points to a separate install guide in the ReadTheDocs site rather than embedding steps, so treat the documentation as the source of truth for the current procedure. The package is on PyPI and the console entry point is declared in pyproject.toml as rqalpha, mapping to rqalpha.__main__:entry_point, so the command below is the one the packaging metadata defines. RQAlpha supports Python 3.8 through 3.14 according to the classifiers, and requires Python 3.8 or newer. Note the numpy split in the dependency list: numpy below 2.0.0 on Python 3.11 and earlier, numpy 2.0.0 or newer on Python 3.12 and up. On a fresh environment:

```bash
pip install rqalpha
rqalpha --help
```

After installation, the Mod commands are the first thing worth checking, because they tell you what the engine will actually do when you run a strategy. The README gives these three forms verbatim:

```bash
# list installed Mods and their status
rqalpha mod list
# enable a Mod
rqalpha mod enable xxx
# disable a Mod
rqalpha mod disable xxx
```

Replace xxx with a Mod name from the built-in list, for example sys_analyser. The README also references a ten-minute tutorial and a strategy examples page in the documentation; those are where the actual strategy entry points and the run command for a backtest are defined. The README does not reproduce the backtest invocation, so do not guess flags from this article. The repository does ship an examples directory inside the package, referenced in pyproject.toml package-data as examples/*.*, examples/data_source/*.* and examples/extend_api/*.*, which is the most reliable place to find a working strategy file after install.

## The licence is the first thing to read, not the last

The repository metadata reports the licence as NOASSERTION, and setup.py explains why. The file header states that use is governed by a dual structure. Non-commercial use, defined as personal use for non-commercial purposes or use by universities and non-profit research institutes for education and research, follows Apache License 2.0, with a copy available at apache.org. Commercial use, defined as any use for commercial purposes by an individual, or any use for any purpose by a legal entity or other organisation, requires authorisation from Ricequant Technology. Without that authorisation, the header states that no individual may use the software for commercial purposes, including providing, selling, renting, lending, transferring or sublicensing it to third parties, and that no legal entity may use it for any purpose. Where the two licences conflict, the header says the Ricequant licence controls. The pyproject.toml file also carries a license field reading Apache-2.0, which is a narrower statement than setup.py. This is a real ambiguity in the repository and it is not a documentation bug you can ignore. If you are a company, or a solo developer with any commercial intent, the answer is in the setup.py header: contact public@ricequant.com. This article is not legal advice; read both files yourself and get your own counsel before shipping anything.

## Where RQAlpha is the wrong tool

The data dependency is the sharpest limitation. RQAlpha is an engine, and the README's data story runs through RQData, a paid product with a free trial and a private-deployment option. If your goal is a self-contained backtester that downloads free historical data and runs offline, RQAlpha is not that, and the README does not present it as that. There is a rqalpha_mod_tushare project referenced in the README's link list, which suggests an alternative data path exists, but the README does not describe its capabilities or its coverage, so treat it as a lead to investigate rather than a documented substitute. A second limitation is the Mod composition problem described above: because fees, risk checks and progress reporting are all Mods, a misconfigured environment produces plausible-looking results that are wrong in ways the output does not announce. The README does not document a Mod configuration lockfile or a way to assert a required Mod set. Third, the documentation is primarily in Chinese. The ReadTheDocs links point to the zh_CN locale, and the README itself is written in Chinese. If your team cannot read Chinese documentation, your effective onboarding cost is higher than the repository's English-language packaging suggests.

## How RQAlpha differs from vectorised backtesters

The related searches around this project cluster on a set of alternatives: JoinQuant, RQData, Tushare, Akshare, BigQuant, Hikyuu, vectorbt, QuantConnect Lean and Nautilus Trader. The meaningful split is between event-driven and vectorised engines. Vectorised backtesters compute signals across a whole price array at once, which is fast and easy to reason about for simple cross-sectional strategies, but they model order lifecycle poorly: partial fills, per-order risk rejection and intraday scheduling are either approximated or absent. RQAlpha sits on the event-driven side. The sys_simulation Mod provides a matching engine and a backtest event source, and sys_scheduler provides timers that fire logic on a fixed cycle. That combination means an order in RQAlpha goes through a modelled path: risk validation in sys_risk, matching in sys_simulation, fee calculation in sys_transaction_cost, and recording in sys_analyser. The trade-off is speed and setup cost. You pay for the order lifecycle model with slower runs and with the configuration burden of getting the Mod set right. If your strategy is a daily rebalance on a few hundred names and you never care about fill mechanics, an event-driven engine is overhead. If your strategy depends on when an order was placed and whether it was rejected, the vectorised approach will not tell you.

## Maintenance, releases and what an upgrade costs you

The repository is not archived, and the last push was on 2026-09-18. The most recent releases listed are release/6.4.0 on 2026-09-18, release/6.3.0 on 2026-07-23 and release/6.2.1 on 2026-07-10, so the release cadence over that window is roughly one minor version every six to eight weeks. That is a normal pace for a framework with a commercial sponsor behind it. The upgrade cost is where the Mod architecture bites. Because behaviour lives in Mods, a version bump can change what a Mod does without changing your strategy file, and the README does not describe a compatibility contract between RQAlpha versions and Mod versions. The CHANGELOG.rst file at the repository root is the place to look before upgrading, and it is referenced in the README as the update record. The dependency constraints in pyproject.toml are also worth reading before you pin: pandas is capped below 3.0.0, rqrisk requires at least 1.0.10, and the numpy requirement forks on the Python version. A team on Python 3.11 and a team on Python 3.12 will resolve different numpy majors from the same RQAlpha release, which is a source of environment drift in a shared research repo.

## Conclusion

RQAlpha fits individual researchers and non-commercial teams who want a Python event-driven backtester for Chinese A-shares and futures and who can accept the data dependency on RQData. It does not fit commercial deployments without a Ricequant licence, and it does not fit anyone who wants a self-contained backtester with bundled historical data. Before adopting it, check the install guide for the bundle download step, confirm the Mod list on your machine with rqalpha mod list, and read the licence terms in setup.py, which distinguish non-commercial from commercial use.

## FAQ

### How do I install RQAlpha?

It is published on PyPI and installs with pip install rqalpha, which provides the rqalpha console command. The README points to a separate install guide in the ReadTheDocs documentation for the full procedure. Python 3.8 or newer is required.

### Can I use RQAlpha commercially?

Not without authorisation. The setup.py header states that non-commercial use follows Apache License 2.0, while any commercial use by an individual, or any use by a legal entity, requires permission from Ricequant Technology. The header directs licence requests to public@ricequant.com.

### How do I enable or disable a Mod in RQAlpha?

The README gives three commands: rqalpha mod list to see installed Mods and their status, rqalpha mod enable xxx to turn one on, and rqalpha mod disable xxx to turn it off. Built-in Mods include sys_analyser, sys_risk, sys_scheduler and sys_transaction_cost.

### Where does RQAlpha get its market data?

The README describes RQData as the local data service that connects to RQAlpha, called from a strategy with import rqdatac. It covers A-share quotes from 2005, futures and options, funds, convertible bonds, financial statements and style factors. The README also links a rqalpha_mod_tushare project as an alternative data path.

## Sources

- [Issues](https://github.com/ricequant/rqalpha/issues)
- [Project website](http://rqalpha.io)
- [README](https://github.com/ricequant/rqalpha/blob/master/README.md)
- [Releases](https://github.com/ricequant/rqalpha/releases)
- [ricequant/rqalpha on GitHub](https://github.com/ricequant/rqalpha)

---

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