Quick answer
RQAlpha is Ricequant’s open-source Python framework for backtesting and simulated trading of China A-shares and futures. Strategies implement init, before_trading and handle_bar, and a mod system plugs in data sources, risk checks and brokers. Commercial use requires a license from Ricequant.
RQAlpha at a glance
- Category
- Backtest + live trading engines
- Language
- Python
- License
- Apache-2.0 (non-commercial terms apply)
- Does
- Backtesting, Paper trading
- Markets
- Stocks, Futures
- Best for
- China A-share and futures research.
- In AlgoGP
- Use the exported strategy object from your own code
Pick it if
China A-share and futures research.
Watch out for
Chinese-language community.
RQAlpha strengths and limitations
Strengths
- Mod system for data, brokers and analysers.
- A-share trading rules (T+1, price limits) modelled.
Limitations
- Chinese-language community.
- Non-commercial license terms.
RQAlpha example
pip install rqalphafrom rqalpha.apis import order_shares
def init(context):
context.s1 = "000001.XSHE"
def handle_bar(context, bar_dict):
if not context.portfolio.positions[context.s1].quantity:
order_shares(context.s1, 1000)Use RQAlpha with AlgoGP
AlgoGP does not add RQAlpha to projects automatically yet, but nothing stops you using them together. Every AlgoGP project exports plain Python with a framework-neutral strategy object, so you can call it from RQAlpha yourself.
- 1
Design and backtest in AlgoGP
Describe the idea to the copilot and backtest it on AlgoGP’s normalized history.
- 2
Add any bridge to get the adapter core
Adding a bridged framework (for example Backtrader) writes
frameworks/algogp_bridge.py, whoseStrategyBridge.on_bar()returns the orders the strategy wants. - 3
Call it from RQAlpha
Feed RQAlpha’s bars to
StrategyBridge, place the returned orders with RQAlpha, and report fills back withsync().
RQAlpha: frequently asked questions
Can RQAlpha be used commercially?
Commercial use needs a license from Ricequant; check the repository’s license file.
RQAlpha alternatives
- VeighNa (vn.py)PythonChina’s most popular open-source quant platform: GUI trader, CTA strategy engine and backtester with gateways for CTP futures, IB, and crypto.
- QlibPythonMicrosoft’s AI-oriented quant platform: data processing, alpha factor research, ML models (LightGBM to Transformers), backtesting and RD-Agent.
- Zipline ReloadedPythonThe maintained fork of Quantopian’s Zipline: an event-driven, pipeline-based backtester for US equities with data bundles and realistic slippage models.
- BacktraderPythonThe classic Python event-driven backtesting library: Cerebro, data feeds, analyzers, sizers and plotting, with live stores for IB and OANDA.
Independent guide. AlgoGP is not affiliated with RQAlpha. Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.