Skip to main content

AI-powered SDK featuring algorithmic trading, backtesting, deployment on 100+ exchanges, and multiple optimization engines.

Project description

🚀 QTradeX Core — Build, Backtest & Optimize AI-Powered Crypto Trading Bots

QTradeX Demo Screenshot

📸 See screenshots.md for more visuals
📚 Read the docs at qtradex.litepresence.com/docs
🤖 Explore community bots at QTradeX AI Agents DeepWiki
💬 Join our Telegram Group for discussion & support


TL;DR

QTradeX is a lightning-fast Python framework for designing, backtesting, and deploying algorithmic trading bots, built for crypto markets with support for 100+ exchanges, AI-driven optimization, and blazing-fast vectorized execution.

Like what we're doing? Give us a ⭐!


Why QTradeX?

Whether you're exploring a simple EMA crossover or engineering a strategy with 20+ indicators and genetic optimization, QTradeX gives you:

  • Modular, non-locked architecture - want to use QTradeX's data fetching with a custom backtest engine? Go for it!
  • Tulip + CCXT Integration
  • Custom Bot Classes
  • Fast, Disk-Cached Market Data
  • Ultra Fast Backtests (even on a Raspberry Pi!)

🔍 Features at a Glance

  • Bot Development: Extend BaseBot to craft custom strategies
  • Backtesting: Easy-to-navigate CLI & live-coding based testing platform (Just select Autobacktest)
  • Optimization: Use QPSO, LSGA, or others to fine-tune parameters
  • Indicators: Wrapped Tulip indicators for blazing performance
  • Data Sources: Pull candles from 100+ CEXs/DEXs with CCXT
  • Performance Metrics: Evaluate bots with ROI, Sortino, Win Rate, and dozens more
  • Speed: 200+ backtests per second for 3 years of daily candles on a Ryzen 5600x

Project Structure

qtradex/
├── core/             # Bot logic and backtesting
├── indicators/       # Technical indicators
├── optimizers/       # QPSO, LSGA, other optimizers, and common utilities
├── plot/             # Trade/metric visualization
├── private/          # Execution & paper wallets
├── public/           # Data feeds and utils
└── common/           # JSON RPC, BitShares nodes, and data caching

Quickstart

Install

pip install qtradex

Or, if you want the latest updates:

git clone https://github.com/squidKid-deluxe/QTradeX-Algo-Trading-SDK.git QTradeX
cd QTradeX
pip install -e .

Example Bot: EMA Crossover

import qtradex as qx
import numpy as np


class EMACrossBot(qx.BaseBot):
    def __init__(self):
        # Notes:
        # - If you make the tune values integers, the optimizers
        #   will quantize them to the nearest integer.
        # - By putting `_period` at the end of a tune value,
        #   QTradeX core will assume they are periods in days and will scale them
        #   to different candle sizes if the data given isn't daily
        self.tune = {
            "fast_ema_period": 10.0,
            "slow_ema_period": 50.0
        }
        self.clamps = {
            "fast_ema_period": [5, 10, 50, 1],
            "slow_ema_period": [20, 50, 100, 1],
        }

    def indicators(self, data):
        return {
            "fast_ema": qx.ti.ema(data["close"], self.tune["fast_ema"]),
            "slow_ema": qx.ti.ema(data["close"], self.tune["slow_ema"]),
        }

    def strategy(self, tick_info, indicators):
        fast = indicators["fast_ema"]
        slow = indicators["slow_ema"]
        if fast > slow:
            return qx.Buy()
        elif fast < slow:
            return qx.Sell()
        return qx.Thresholds(buying=fast * 0.8, selling=fast * 1.2)

    def plot(self, *args):
        qx.plot(
            self.info,
            *args,
            (
                # key name    label    color   axis idx   axis name
                ("fast_ema", "EMA 1", "white", 0,        "EMA Cross"),
                ("slow_ema", "EMA 2", "cyan",  0,        "EMA Cross"),
            )
        )


# Load data and run
data = qx.Data(
    exchange="kucoin",
    asset="BTC",
    currency="USDT",
    begin="2020-01-01",
    end="2023-01-01"
)
bot = EMACrossBot()
qx.dispatch(bot, data)

See more bots in QTradeX AI Agents


Usage Guide

Step What to Do
1️⃣ Build a bot with custom logic by subclassing BaseBot
2️⃣ Backtest using qx.dispatch + historical data
3️⃣ Optimize with any algorithm you like (optimized tunes stored per-bot in tunes/)
4️⃣ Deploy live

Roadmap

  • More indicators (non-Tulip sources)
  • GPU Acceleration for indicators
  • Improved multi-core support for optimization
  • Windows/Mac support
  • TradFi Connectors: Stocks, Forex, and Comex support

Want to help out? Check out the Issues list for forseeable improvements and bugs.


Resources


📜 License

WTFPL — Do what you want. Just be awesome about it 😎


⭐ Star History

Star History Chart

✨ Ready to start? Clone the repo, run your first bot, and tune away. Once tuned - LET THE EXECUTIONS BEGIN!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

qtradex-1.6.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

qtradex-1.6.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

qtradex-1.6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

qtradex-1.6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file qtradex-1.6.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qtradex-1.6.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4f5b66f5ef6142a46b3bc853b91d33728923501a9bf641911a51cb464f7f27b
MD5 ff8087efc217707d84f6a326c3fe328e
BLAKE2b-256 9ff638b189c7a1d13bf289480cb659f655b45be8a63debf1e3258e1732f90d93

See more details on using hashes here.

Provenance

The following attestation bundles were made for qtradex-1.6.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on squidKid-deluxe/QTradeX-Algo-Trading-SDK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qtradex-1.6.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qtradex-1.6.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 413feeda98878df4a1ec673639b0e7baaca29b56982d186e2055759de1af6185
MD5 a182120e4020986b970db15cd69278a8
BLAKE2b-256 bbbd9d5045e1cec1a377e5ed674d2bd519465d817508eab9d3d702d1a8aa3008

See more details on using hashes here.

Provenance

The following attestation bundles were made for qtradex-1.6.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on squidKid-deluxe/QTradeX-Algo-Trading-SDK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qtradex-1.6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qtradex-1.6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 65dd4a011d23b275e9e20471471e649b940d170d851d6297dd791b431e80e785
MD5 27ea80f44ff44615a3b8f2a6be7bb3b2
BLAKE2b-256 daa11ad4b68349273d75cd0bc9a2e768f985a2fbee438cbe79b0d406933d2b75

See more details on using hashes here.

Provenance

The following attestation bundles were made for qtradex-1.6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on squidKid-deluxe/QTradeX-Algo-Trading-SDK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qtradex-1.6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qtradex-1.6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13b86efbbdfa5d10ee0baabaafdf3d422f017fbb749586e7d92d9f7621d8e3cc
MD5 a5829917deef46ecd92741e586155faa
BLAKE2b-256 d6f709aada88d1c826e8f390a6cbb4d2eb4b560b70c26158c559354b6736876b

See more details on using hashes here.

Provenance

The following attestation bundles were made for qtradex-1.6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on squidKid-deluxe/QTradeX-Algo-Trading-SDK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page