Convert Figma logo to code with AI

yutiansut logoQUANTAXIS

QUANTAXIS 支持任务调度 分布式部署的 股票/期货/期权 数据/回测/模拟/交易/可视化/多账户 纯本地量化解决方案

8,093
2,950
8,093
230

Top Related Projects

9,713

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)

15,357

Qlib is an AI-oriented quantitative investment platform that aims to realize the potential, empower research, and create value using AI technologies in quantitative investment, from exploring ideas to implementing productions. Qlib supports diverse machine learning modeling paradigms. including supervised learning, market dynamics modeling, and RL.

An Algorithmic Trading Library for Crypto-Assets in Python

Portfolio analytics for quants, written in Python

:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python.

Quick Overview

QUANTAXIS is an open-source quantitative trading and investment research platform developed in Python. It provides a comprehensive set of tools for financial data acquisition, processing, analysis, and strategy backtesting, aimed at both individual investors and institutional traders.

Pros

  • Comprehensive ecosystem with modules for data fetching, analysis, backtesting, and live trading
  • Supports multiple asset classes including stocks, futures, and cryptocurrencies
  • Integrates with various data sources and exchanges
  • Active community and regular updates

Cons

  • Steep learning curve for beginners due to its extensive features
  • Documentation is primarily in Chinese, which may be challenging for non-Chinese speakers
  • Some users report occasional stability issues with certain modules
  • Performance can be slow for large-scale backtests without optimization

Code Examples

  1. Fetching stock data:
from QUANTAXIS import QA_fetch_stock_day_adv

data = QA_fetch_stock_day_adv('000001', '2020-01-01', '2021-01-01')
print(data.data)
  1. Creating a simple moving average strategy:
from QUANTAXIS import QA_Strategy

class MAStrategy(QA_Strategy):
    def on_bar(self, data):
        if data.close > data.close.rolling(20).mean():
            self.buy(data.code, 100)
        elif data.close < data.close.rolling(20).mean():
            self.sell(data.code, 100)

strategy = MAStrategy(start='2020-01-01', end='2021-01-01', code='000001')
strategy.run()
  1. Backtesting a strategy:
from QUANTAXIS import QA_Backtest

backtest = QA_Backtest(strategy=MAStrategy, start='2020-01-01', end='2021-01-01', code_list=['000001', '600000'])
result = backtest.run()
backtest.analyze()

Getting Started

  1. Install QUANTAXIS:
pip install quantaxis
  1. Initialize the QUANTAXIS environment:
import QUANTAXIS as QA
QA.QA_util_log_info('Welcome to QUANTAXIS')
  1. Fetch and analyze data:
stock_data = QA.QA_fetch_stock_day_adv('000001', '2020-01-01', '2021-01-01')
print(stock_data.data.head())
  1. Run a simple backtest:
from QUANTAXIS.QAARP.QAStrategy import QA_Strategy

class SimpleStrategy(QA_Strategy):
    def on_bar(self, data):
        self.buy(data.code, 100)

backtest = QA.QA_Backtest(strategy=SimpleStrategy, start='2020-01-01', end='2021-01-01', code_list=['000001'])
result = backtest.run()
backtest.analyze()

Competitor Comparisons

9,713

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)

Pros of Lean

  • More extensive documentation and community support
  • Broader range of supported asset classes and data sources
  • Better integration with cloud platforms and live trading systems

Cons of Lean

  • Steeper learning curve for beginners
  • Requires more computational resources
  • Less focus on Chinese markets compared to QUANTAXIS

Code Comparison

QUANTAXIS example:

import QUANTAXIS as QA
data = QA.QA_fetch_stock_day_adv('000001', '2019-01-01', '2019-12-31')
QA.QA_SU_save_stock_day('tdx')

Lean example:

public class MyAlgorithm : QCAlgorithm
{
    public override void Initialize()
    {
        SetStartDate(2019, 1, 1);
        SetEndDate(2019, 12, 31);
        AddEquity("SPY", Resolution.Daily);
    }
}

QUANTAXIS focuses on simplicity and ease of use for Chinese markets, while Lean offers a more comprehensive and flexible framework for algorithmic trading across various markets. QUANTAXIS provides straightforward data fetching and saving functions, whereas Lean requires a more structured approach with algorithm initialization and asset addition.

15,357

Qlib is an AI-oriented quantitative investment platform that aims to realize the potential, empower research, and create value using AI technologies in quantitative investment, from exploring ideas to implementing productions. Qlib supports diverse machine learning modeling paradigms. including supervised learning, market dynamics modeling, and RL.

Pros of Qlib

  • More extensive documentation and examples
  • Stronger focus on machine learning and AI-driven quantitative investment
  • Backed by Microsoft, potentially leading to better long-term support and development

Cons of Qlib

  • Steeper learning curve for beginners in quantitative finance
  • Less comprehensive in terms of traditional financial analysis tools
  • Primarily focused on the Chinese stock market, which may limit its applicability for global investors

Code Comparison

QUANTAXIS:

import QUANTAXIS as QA
data = QA.QA_fetch_stock_day_adv('000001', '2017-01-01', '2017-12-31')
QA.QA_SU_save_stock_day('tdx')

Qlib:

from qlib.data import D
from qlib.config import REG_CN
D.calendar(start_time='2010-01-01', end_time='2017-12-31', freq='day')
D.features(["SH600000"], ["$close", "$volume"], start_time='2010-01-01', end_time='2017-12-31')

Both repositories offer powerful tools for quantitative finance, but they cater to slightly different audiences. QUANTAXIS provides a more comprehensive suite of traditional financial analysis tools, while Qlib focuses on leveraging machine learning for quantitative investment strategies. The choice between the two depends on the user's specific needs and level of expertise in both finance and machine learning.

An Algorithmic Trading Library for Crypto-Assets in Python

Pros of Catalyst

  • Focuses on cryptocurrency trading and backtesting
  • Provides integration with popular exchanges like Binance and Coinbase
  • Offers a more specialized toolset for crypto-specific strategies

Cons of Catalyst

  • Limited to cryptocurrency markets, less versatile for traditional assets
  • Smaller community and fewer resources compared to QUANTAXIS
  • Less frequent updates and maintenance

Code Comparison

QUANTAXIS:

from QUANTAXIS import QA_Backtest
backtest = QA_Backtest()
backtest.strategy = myStrategy
backtest.run()

Catalyst:

from catalyst import run_algorithm
run_algorithm(
    capital_base=10000,
    data_frequency='daily',
    initialize=initialize,
    handle_data=handle_data,
    exchange_name='poloniex'
)

Both repositories provide quantitative trading frameworks, but they cater to different markets and use cases. QUANTAXIS offers a more comprehensive solution for Chinese markets and traditional assets, while Catalyst specializes in cryptocurrency trading. QUANTAXIS has a larger community and more frequent updates, making it potentially more suitable for general quantitative trading needs. Catalyst, on the other hand, provides a more focused approach for crypto enthusiasts and traders looking to implement strategies specifically for digital assets.

Portfolio analytics for quants, written in Python

Pros of QuantStats

  • Focused on performance analytics and risk metrics
  • Generates detailed HTML reports for portfolio analysis
  • Lightweight and easy to integrate into existing Python projects

Cons of QuantStats

  • Limited to post-trade analysis and reporting
  • Lacks real-time data fetching and trading capabilities
  • Smaller community and fewer contributors compared to QUANTAXIS

Code Comparison

QuantStats:

import quantstats as qs

# Extend pandas functionality with metrics
qs.extend_pandas()

# Generate tearsheet
qs.reports.html(returns, output='tearsheet.html')

QUANTAXIS:

import QUANTAXIS as QA

# Fetch stock data
data = QA.QA_fetch_stock_day_adv('000001', '2019-01-01', '2020-01-01')

# Perform backtest
backtest = QA.QA_Backtest(strategy=MyStrategy, benchmark_code='000300')
backtest.run()

Summary

QuantStats excels in performance analysis and reporting, making it ideal for portfolio managers and analysts. QUANTAXIS offers a more comprehensive suite of tools for quantitative trading, including data fetching, backtesting, and real-time trading capabilities. QuantStats is more accessible for beginners and those focused on post-trade analysis, while QUANTAXIS caters to more advanced users requiring a full-stack quantitative trading platform.

:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python.

Pros of backtesting.py

  • Lightweight and easy to use, with a focus on simplicity
  • Fast execution due to optimized Cython implementation
  • Extensive documentation and examples for quick start

Cons of backtesting.py

  • Limited to backtesting only, lacks real-time trading capabilities
  • Fewer built-in indicators and analysis tools compared to QUANTAXIS
  • Less comprehensive ecosystem and community support

Code Comparison

QUANTAXIS:

import QUANTAXIS as QA

data = QA.QA_fetch_stock_day_adv('000001', '2010-01-01', '2019-01-01')
QA.QA_Risk_analysis(data)

backtesting.py:

from backtesting import Backtest, Strategy
from backtesting.lib import crossover

class SmaCross(Strategy):
    def init(self):
        self.sma1 = self.I(SMA, self.data.Close, 10)
        self.sma2 = self.I(SMA, self.data.Close, 20)

    def next(self):
        if crossover(self.sma1, self.sma2):
            self.buy()
        elif crossover(self.sma2, self.sma1):
            self.sell()

Summary

QUANTAXIS offers a more comprehensive suite of tools for quantitative analysis and trading, including real-time capabilities and a broader ecosystem. backtesting.py, on the other hand, provides a lightweight and fast solution specifically for backtesting trading strategies, with a focus on simplicity and ease of use. The choice between the two depends on the specific needs of the project and the user's preference for either a more comprehensive toolkit or a specialized backtesting solution.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

QUANTAXIS 2.0.0

Github workers GitHub stars GitHub forks

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

QUANTAXIS_LOGO_LAST_small.jpg

gvp

更多文档在QABook Release

Quantitative Financial FrameWork

本项目分为几个大块:

  1. QASU/ QAFetch 支持多市场数据存储/ 自动运维/ 数据获取(mongodb/ clickhouse)

  2. QAUtil 支持交易时间, 交易日历, 时间向前向后推算, 市场识别, dataframe 数据转换等

  3. QIFI/ QAMarket 一套统一的多市场 多语言账户体系

    • qifiaccount qifi 的标准账户体系, 在多语言上和 rust/cpp 版本的 qifi account 保持一致性
    • qifimanager qifi 多账户管理体系 支持多个语言的账户统一管理
    • qaposition 单标的仓位管理模块, 支持对于单标的的精准多空控制(套利场景/ cta 场景/ 股票场景)
    • marketpreset 市场预制基类, 方便查询期货/股票/虚拟货币 品种 tick/ 保证金/ 手续费等
  4. QAFactor 因子研究套件

    • 单因子研究入库

    • 因子管理, 测试

    • 因子合并

    • 优化器

  5. QAData 多标的多市场的数据结构, 可以作为实时计算和回测的内存数据库使用

  6. QAIndicator 支持自定义指标编写, 批量全市场 apply, 支持因子表达式构建

  7. QAEngine 自定义线程进程基类, 可以自行修改计算的异步和局域网内分布式计算 agent

  8. QAPubSub 基于 MQ 的消息队列, 支持 1-1 1-n n-n 的消息分发, 可用于计算任务分发收集, 实时订单流等场景

  9. QAStrategy cta/套利回测套件, 支持 QIFI 模式

  10. QAWebServer tornadobase 的 webserver 套件, 可以作为中台微服务构建

  11. QASchedule 基于 QAWerbServer 的后台任务调度 支持自动运维, 远程任务调度等

本版本为不兼容升级的 2.0 quantaxis, 涉及一些改变

数据部分

  • 增加 clickhouse client 自建数据源分发

  • 增加数据格式

    • 对于 tabular data 的支持
    • 支持因子化的数据结构
  • 支持 tick/l2 order/transaction 的数据格式

微服务部分

  • 增加 QAWEBSEBVER

  • 支持动态的任务指派的 sechedule

  • 增加 基于 DAG模型的pipeline

  • 增加 QAPUBSUB模块 支持 rabbitmq

账户部分

  • 删除 QAARP 不再维护老版本 account 系统

  • 升级完整的 qifi 模块 支持多市场/跨市场的账户模型

    • 支持保证金模型

    • 支持股票

    • 支持期货

    • 期权[升级中]

实盘模拟盘部分

  • 使用稳定的 qifi 结构对接

  • 支持 CTP 接口的

    • 期货
    • 期权
  • 支持股票部分

    • QMT 对接
  • 母子账户的订单分发跟踪 [OMS]

  • ordergateway 风控订单流规则

多语言部分

  • 支持于 QUANTAXIS Rust 版本的通信

  • 基于 arrow 库, 使用多语言支持的 pyarrow 格式, 对接 arrow-rs, datafusion-rs, libarrow(CPP)

  • 支持 RUST/ CPP 账户

  • 支持因子化的 rust job worker

社区/项目捐赠

github

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

许多问题 可以在 GITHUB ISSUE中找到, 你可以提出新的issue

捐赠

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

(PS: 支付的时候 请带上你的名字/昵称呀 会维护一个赞助列表~ )

QQ群

欢迎加群讨论: 563280067 群链接

DISCORD 社区 https://discord.gg/mkk5RgN

QUANTAXIS 开发群: 773602202 (如果想要贡献代码 请加这个群 需要备注你的GITHUB ID)

QUANTAXIS 期货实盘多账户的本地部署群 (请勿浪费群资源 没有本地多账户部署的请勿加): 945822690

公共号

欢迎关注公众号: 公众号

QAPRO公共号免费提供了下单推送接口, 关注公共号回复trade即可使用

论坛 QACLUB

QUANTAXIS 内测版论坛 QUANTAXISCLUB上线

http://www.yutiansut.com:3000

凡通过论坛进行提问的 均有最高的回复优先级