QUANTAXIS README

The project's README from github.com/yutiansut/QUANTAXIS. As one markdown file: README.md.

QUANTAXIS 2.1.0-alpha2

⭐ 如果这个项目对您有帮助,请点击Star支持我们!

🔄 Fork本项目开始您的量化交易之旅!

Made with ❤️ by @yutiansut and contributors

© 2016-2025 QUANTAXIS. Released under the MIT License.

Powered by OrcaRouter

🚀 全新升级: Python 3.9+、QARS2 Rust核心集成、100x性能提升

最新版本: v2.1.0-alpha2 | Python: 3.9-3.12 | 更新日期: 2025-10-25


🌟 新特性 (v2.1.0)

⚡ QARS2 Rust核心集成 - 性能飞跃

🔧 Python 3.9-3.12 现代化

📦 QARSBridge - Rust桥接层

from QUANTAXIS.QARSBridge import QARSAccount, has_qars_support

# 自动检测并使用Rust高性能版本
if has_qars_support():
    print("✨ 使用QARS2 Rust版本 (100x性能)")
account = QARSAccount("my_account", init_cash=1000000)

# API完全兼容,无需修改代码
account.buy("000001", 10.5, "2025-01-15", 1000)

🔗 相关项目生态

核心项目

扩展实现

Github workers GitHub stars GitHub forks

[点击右上角Star和Watch来跟踪项目进展! 点击Fork来创建属于你的QUANTAXIS!]

QUANTAXIS_LOGO_LAST_small.jpg


📞 联系方式


更多文档在QABook Release

Quantitative Financial FrameWork

📚 核心模块

1. 🦀 QARSBridge - Rust桥接层 (v2.1新增)

QARS2 Rust核心的Python包装器,提供100x性能提升

# 完整示例
from QUANTAXIS.QARSBridge import QARSAccount

account = QARSAccount("test", init_cash=1000000)
account.buy("000001", 10.5, "2025-01-15", 1000)      # 股票买入
account.buy_open("IF2512", 4500.0, "2025-01-15", 2)  # 期货开仓
positions = account.get_positions()                   # 查询持仓

📖 详细文档: QARSBridge README


2. 🔄 QADataBridge - 零拷贝数据交换 (v2.1新增)

基于QADataSwap的跨语言零拷贝数据传输,5-10x性能提升

# 零拷贝转换示例
from QUANTAXIS.QADataBridge import convert_pandas_to_polars
import pandas as pd

df_pandas = pd.DataFrame({'price': [10.5, 20.3], 'volume': [1000, 2000]})
df_polars = convert_pandas_to_polars(df_pandas)  # 零拷贝,2.5x加速

# 共享内存示例
from QUANTAXIS.QADataBridge import SharedMemoryWriter, SharedMemoryReader

# 进程A:写入数据
writer = SharedMemoryWriter("market_data", size_mb=50)
writer.write(df_polars)

# 进程B:读取数据
reader = SharedMemoryReader("market_data")
df = reader.read(timeout_ms=5000)  # 零拷贝,7x加速

📖 详细文档: QADataBridge README


3. 💾 QASU / QAFetch - 多市场数据

4. 🕐 QAUtil - 工具函数

5. 💼 QIFI / QAMarket - 统一账户体系

多市场、多语言统一账户协议

QIFI协议特点:

6. 📊 QAFactor - 因子研究

7. 📈 QAData - 内存数据库

多标的多市场数据结构,支持:

8. 📉 QAIndicator - 自定义指标

9. ⚙️ QAEngine - 异步计算

10. 📮 QAPubSub - 消息队列

基于RabbitMQ的消息系统:

11. 🎯 QAStrategy - 回测套件

12. 🌐 QAWebServer - 微服务

13. 📅 QASchedule - 任务调度


🆕 版本更新说明

v2.1.0 (2025-10-25) - 重大性能升级

🚀 核心升级

1. QARS2 Rust核心集成

2. Python现代化

3. 新增模块

4. 安装方式优化

# 基础安装
pip install -e .

# 包含Rust组件 (推荐)
pip install -e .[rust]

# 包含性能优化包
pip install -e .[performance]

# 完整安装
pip install -e .[full]

📝 升级文档


v2.0.0 - 架构重构

本版本为不兼容升级,涉及重大架构改变:

数据层改进

微服务架构

账户系统升级

实盘/模拟盘

多语言集成


🚀 快速开始

系统要求

安装

1. 基础安装

# 克隆仓库
git clone https://github.com/QUANTAXIS/QUANTAXIS.git
cd QUANTAXIS

# 安装依赖
pip install -e .

2. 包含Rust组件 (推荐 - 100x性能)

# 安装QUANTAXIS + QARS2
pip install -e .[rust]

# 或手动安装QARS2
cd /home/quantaxis/qars2
pip install -e .

3. 完整安装

# 安装所有组件
pip install -e .[full]

# 包含:
# - QARS2 Rust核心
# - QADataSwap跨语言通信
# - Polars高性能DataFrame
# - 所有可选依赖

4. 验证安装

import QUANTAXIS as QA
from QUANTAXIS.QARSBridge import has_qars_support

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

# 预期输出:
# QUANTAXIS版本: 2.1.0.alpha2
# QARS2支持: True

快速示例

from QUANTAXIS.QARSBridge import QARSAccount

# 创建高性能账户 (自动使用Rust核心)
account = QARSAccount(
    account_cookie="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)
account.sell_close("IF2512", 4520.0, "2025-01-16", 1)

# 查询持仓
positions = account.get_positions()
print(positions)

# 获取QIFI格式账户数据
qifi = account.get_qifi()
print(f"账户权益: {qifi['accounts']['balance']}")
print(f"可用资金: {qifi['accounts']['available']}")

数据库配置

# MongoDB配置
import QUANTAXIS as QA

# 设置MongoDB连接
QA.DATABASE = QA.QAUtil.QALogs.QA_Setting.MONGO_URI
# 默认: mongodb://localhost:27017/quantaxis

# ClickHouse配置
QA.CLICKHOUSE_HOST = 'localhost'
QA.CLICKHOUSE_PORT = 9000

📖 文档

📚 文档中心

完整文档请访问 文档中心 (Documentation Hub)

快速导航

🚀 入门指南

📘 API参考

🔧 高级功能

🐳 部署指南

📦 迁移指南

👨‍💻 开发者

📘 其他资源


🤝 社区与支持

GitHub

QUANTAXIS 是一个开放的项目, 在开源的3年中有大量的小伙伴加入了我, 并提交了相关的代码, 感谢以下的同学们

问题反馈:

社群

QQ群

Discord

论坛

公众号

公众号


📊 性能对比

QARS2 Rust vs Python

操作 Python版本 QARS2 Rust 加速比
创建1000个账户 ~50秒 ~0.5秒 100x ⚡
发送10000个订单 ~50秒 ~0.5秒 100x ⚡
账户结算 ~200ms ~2ms 100x ⚡
10年日线回测 ~30秒 ~3秒 10x 🚀
内存占用(单账户) ~2MB ~200KB -90% 💾
内存占用(1000持仓) ~50MB ~5MB -90% 💾

Python版本性能

Python版本 性能提升 推荐度
Python 3.9 基准 ⭐⭐⭐
Python 3.10 +10% ⭐⭐⭐⭐
Python 3.11 +25% ⭐⭐⭐⭐⭐ 最佳
Python 3.12 +20% ⭐⭐⭐⭐⭐ 最新

💰 项目支持

捐赠

写代码不易...请作者喝杯咖啡呗? ☕

支付宝捐赠

注: 支付时请备注您的名字/昵称,我们会维护一个赞助列表感谢您的支持!

企业赞助

如需企业级支持、定制开发或技术咨询,请联系:


📜 许可证

本项目采用 MIT License 开源许可证。

Copyright (c) 2016-2025 yutiansut/QUANTAXIS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...

完整许可证请查看 LICENSE 文件。


👏 致谢

核心贡献者

特别感谢所有为QUANTAXIS做出贡献的开发者!

技术栈

QUANTAXIS得以实现离不开以下优秀的开源项目:

特别鸣谢


🗺️ 路线图

v2.1.x (当前)

v2.2.0 (计划中)

v3.0.0 (未来)

QUANTAXIS (yutiansut/QUANTAXIS)

Searching Database…

11.3K ·GitHub
What is this?QUANTAXIS is a local-first quantitative trading framework for China's stock, futures and options markets, covering data fetching, backtesting, paper trading, live trading, visualization and multi-account management, with support for distributed task scheduling.
Is this a ready-made trading app or a framework I build on?It is a Python framework made of many modules (QAFetch, QAData, QAEngine, QAStrategy, QAWebServer, etc.) that you assemble into your own quant pipeline, not a single turnkey app.
How do I get it running?Install the base Python package, then optionally add the Rust (QARS2) components for up to 100x faster accounts and backtests; a full install plus MongoDB/ClickHouse gives you the complete data-to-trading pipeline.
What do I need to run it besides Python?You need Python 3.9-3.12 (3.11+ recommended) and MongoDB 4.0+ for data storage; ClickHouse 20.0+ is optional, and the Rust QARS2 core is optional but recommended for the big speedups.
Any catches before I rely on this?It is still a pre-release (v2.1.0-alpha2), the QADataSwap zero-copy data bridge is 'in progress', and v2.0 was an incompatible rewrite that dropped the older QAARP account module entirely.
Does it only run on Linux servers?No, it runs locally on Linux, macOS or Windows; it's a self-hosted Python install, not a hosted SaaS.
What is QARS2 and why does it matter?QARS2 is a Rust core that QUANTAXIS wraps through QARSBridge, giving up to 100x faster account operations and 10x faster backtests, with automatic fallback to pure Python if it isn't installed.
What is the QIFI protocol?QIFI is QUANTAXIS' unified account protocol for positions, orders and trades that stays 100% consistent across the Python, Rust and C++ implementations, so you can swap in faster engines without changing your account logic.
Can I actually trade live, or is this backtest-only?It supports live and simulated trading via CTP (futures/options) and QMT (stocks) interfaces, plus parent-child account order management and risk control through an OrderGateway.
Why bother with a Rust core instead of staying pure Python?Creating 1000 accounts or sending 10000 orders takes about 50 seconds in pure Python versus roughly 0.5 seconds with the QARS2 Rust core, while also cutting memory use by around 90%, which matters for large multi-account backtests.
Creator
yutiansut
Size
133.3 MB
Stars
11.3K
Age
10y
Commits · 90 Days