Skip to content

Guide · Open source

How to use QUANTAXIS: install, run and try the quickstart

Updated · written with AI from the project's own documentation and checked against our catalogue data

QUANTAXIS is an open-source Python framework for quantitative trading, aimed mainly at Chinese stock and futures markets. It covers market data storage, backtesting, simulated and live trading, multi-account management and scheduled tasks, with an emphasis on running locally. This guide walks through installing it from source, checking the install, and running a first QARSAccount example.

QUANTAXISyutiansut/QUANTAXIS · ★ 11.3k · MIT

Quick start

  1. 1Check Python version. Confirm you have Python between 3.9 and 3.12, preferably 3.11 or newer.
  2. 2Clone the repository. Run git clone on the QUANTAXIS repository and enter the project folder.
  3. 3Install with pip. Run pip install -e . from the project folder to install dependencies in editable mode.
  4. 4Verify the install. Import QUANTAXIS and check the version and whether QARS2 support is available.
  5. 5Run the account example. Create a QARSAccount and record a test trade to confirm the API works.
  6. 6Set up a database if needed. Install MongoDB or ClickHouse if you want to store market data locally, then point QUANTAXIS at it.

Check the requirements before you install

The README lists Python 3.9 to 3.12 as the supported range, with 3.11 or newer recommended. It lists Linux, macOS and Windows as operating systems and 4GB of RAM as a minimum, with 8GB or more recommended.

A database is optional. The README names MongoDB 4.0+ or ClickHouse 20.0+ as options for storing market data.

  • Python 3.9 to 3.12 (3.11+ recommended)
  • Linux, macOS or Windows
  • At least 4GB RAM (8GB+ recommended)
  • MongoDB 4.0+ or ClickHouse 20.0+ (optional)

Install QUANTAXIS from source

The project is installed by cloning the repository and running pip in editable mode from the project folder. Run these commands in a terminal.

The README also lists optional extras for the Rust components. The basic install is enough to start, and the extras are listed in the release notes.

git clone https://github.com/QUANTAXIS/QUANTAXIS.git cd QUANTAXIS pip install -e .

Verify the install

Open Python and import the package. The README's check prints the QUANTAXIS version and whether the QARS2 Rust core is available. If QARS2 is not installed, the README says QARSBridge falls back to the pure Python implementation.

import QUANTAXIS as QA from QUANTAXIS.QARSBridge import has_qars_support print(f"QUANTAXIS版本: {QA.__version__}") print(f"QARS2支持: {has_qars_support()}")

Run a first account example

The README's quick example creates a QARSAccount with starting cash, then records a stock buy and sell and a futures open and close. Dates are passed as strings. Stock codes and futures contract codes are passed as strings.

Account state can be read with get_positions() and get_qifi(). The README notes that the API is intended to stay the same whichever backend runs underneath.

  • buy() and sell() handle stock trades
  • buy_open(), sell_open(), buy_close() and sell_close() handle futures trades
  • get_positions(), get_account_info() and get_qifi() read account state
from QUANTAXIS.QARSBridge import QARSAccount account = QARSAccount("my_strategy", init_cash=1000000.0) account.buy("000001", 10.5, "2025-01-15", 1000) account.sell("000001", 10.8, "2025-01-16", 500) account.buy_open("IF2512", 4500.0, "2025-01-15", 2) positions = account.get_positions() print(positions)

Configure a database (optional)

The README shows MongoDB and ClickHouse settings in the Python session. The default MongoDB address given is mongodb://localhost:27017/quantaxis. The ClickHouse example uses localhost on port 9000.

Treat these as the README's examples. Check your own database host, port and credentials before relying on them.

import QUANTAXIS as QA QA.CLICKHOUSE_HOST = 'localhost' QA.CLICKHOUSE_PORT = 9000

Explore the modules and docs

The README lists modules for data fetching (QAFetch, QASU), utilities (QAUtil), accounts (QIFI), factor research (QAFactor), indicators (QAIndicator), backtesting (QAStrategy), scheduling (QASchedule) and messaging (QAPubSub, which uses RabbitMQ). Most of the README and docs are in Chinese, so expect to read Chinese or use a translation tool.

The documentation hub is at doc/README.md in the repository. The project homepage is https://yutiansut.github.io/QUANTAXIS/.

  • QAFetch: data retrieval
  • QAStrategy: backtesting suite for CTA and arbitrage strategies
  • QASchedule: background and remote task scheduling
  • QAPubSub: message queue built on RabbitMQ

What people use it for

  • Building and testing CTA or arbitrage strategies for Chinese futures and stocks
  • Storing and updating Chinese market data locally in MongoDB or ClickHouse
  • Managing several trading accounts through the QIFI account system
  • Scheduling background data updates with QASchedule
  • Running factor research with QAFactor

Frequently asked questions

Is QUANTAXIS free to use?

QUANTAXIS is released under the MIT License, as stated in the README. The license terms are in the repository's license file.

What Python version does QUANTAXIS need?

The README lists Python 3.9 to 3.12 as supported, with 3.11 or newer recommended. It does not promise that other versions will work.

Do I need MongoDB to use QUANTAXIS?

No. The README lists MongoDB 4.0+ or ClickHouse 20.0+ as optional database choices for storing market data.

How do I install QUANTAXIS?

Clone the GitHub repository, enter the QUANTAXIS folder and run pip install -e . The README gives these commands in its quickstart section.

Is there English documentation?

The README and many docs are primarily in Chinese. The README does not describe an English translation, so plan on reading Chinese or using a translation tool.

How does QUANTAXIS compare to Backtrader, Zipline, vn.py or RQAlpha?

The source does not compare these projects, so this guide makes no claim about their relative performance or features. QUANTAXIS's README emphasises Chinese stock and futures markets, local running and multi-account management, which you can weigh against your own needs.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

QUANTAXIS suits Python developers who work on Chinese stocks or futures and are comfortable with Chinese documentation, local databases and some setup effort. Beginners without programming experience, or anyone needing English docs and a guaranteed setup outside Python 3.9 to 3.12, should look at another framework such as Backtrader or Zipline.

Install options & downloads