QTrade

QTrade is a simple, modular, and highly customizable trading interface capable of handling backtesting, reinforcement learning tasks.

With features ranging from traditional signal-based strategies to reinforcement learning-driven approaches, QTrade allows traders to focus on developing and testing strategies without the burden of implementation details.

Key Features

  • Backtesting: Single-asset or multi-asset / portfolio strategies with shared cash and per-asset positions.

  • Reinforcement Learning: A highly customizable Gymnasium environment for training and testing AI-driven trading agents.


How to Use

  1. Install QTrade Follow the instructions in the Installation Guide to set up QTrade in your Python environment.

  2. Explore Tutorials Learn to create strategies, backtest them, and use gym trading environment by following the Getting Started and the Trading Environment.

  3. API Reference Dive deeper into QTrade’s core components with the API Reference.


Installation

QTrade can be installed with pip:

$ pip install qtrade-lib

QTrade ships several optional extras for things you don’t always need:

$ pip install "qtrade-lib[rl]"     # RL training utilities (stable-baselines3)
$ pip install "qtrade-lib[data]"   # yfinance loader for US tickers
$ pip install "qtrade-lib[cn]"     # akshare loader for Chinese A-shares + futures

Alternatively, you can obtain the latest source code from GitHub:

$ git clone https://github.com/gguan/qtrade.git
$ cd qtrade
$ pip install .

To run the example code:

$ python examples/simple_strategy.py

Usage

The User Guide is the place to learn how to use the library and accomplish common tasks.

The API Reference covers the core, backtest, and environment modules.