Lightning-fast Python framework for algorithmic trading. Deploy on 100+ exchanges with vectorized execution and genetic optimization.
Extend BaseBot to craft custom strategies with powerful indicators.
Easy-to-navigate CLI & live-coding based testing platform (Just select Autobacktest).
Use QPSO, LSGA, or others to fine-tune parameters for maximum performance.
Wrapped Tulip indicators for blazing performance and accurate analysis.
Pull candles from 100+ CEXs & DEXs with seamless CCXT integration.
Evaluate bots with ROI, Sortino, Win Rate, and dozens more metrics.
200+ backtests/sec for 3 years of daily candles on a Ryzen 5600x.
Extend BaseBot to craft custom strategies with clean architecture.
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 = [ # min, max [5, 50 ], # fast_ema [20, 100], # slow_ema ] 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"), ) )
Leverage advanced algorithms like QPSO, LSGA, or others to fine-tune parameters for maximum performance.