QuantLabs

The Trading Bot Blog

Strategy walkthroughs, Python deep-dives, risk frameworks, and infrastructure patterns from practitioners building real bots.

T1risk

Position Sizing with the Kelly Criterion

The Kelly Criterion is mathematically optimal for long-run capital growth — but it will also blow up your account if you apply it naively. Here's how to use a fractional Kelly approach safely.

Risk ManagementMathPosition Sizing
8 minFeb 24, 2026
Read
T2python

Using CCXT as Your Exchange Unification Layer

Managing connections to five different exchanges is a nightmare without abstraction. CCXT solves this — here's how to structure a clean wrapper that handles rate limits, retries, and unified order schemas.

CCXTExchange APIsPython
10 minFeb 20, 2026
Read
T2strategy

The 7 Overfitting Traps in Backtesting (and How to Avoid Them)

A backtest that looks amazing almost always has overfitting problems. We break down the seven most common traps — from look-ahead bias to excessive parameter tuning — with concrete fixes for each.

BacktestingStrategy DesignStatistics
14 minFeb 17, 2026
Read
T3defi

Writing a Uniswap v3 Liquidity Provision Bot

Concentrated liquidity on Uniswap v3 creates real yield opportunities — but managing range rebalancing on-chain requires precise gas estimation and timing logic. Here's the full implementation.

DeFiUniswapOn-chain
18 minFeb 12, 2026
Read
T3infrastructure

Using Redis to Cache Open Orders in a Live Trading Bot

REST polling for open orders is slow and burns API rate limits. Redis gives you a sub-millisecond in-memory cache layer with atomic updates — here's the exact architecture we use in production.

RedisInfrastructurePerformance
9 minFeb 8, 2026
Read
T1market analysis

Crypto Market Microstructure 101

Before you write a single line of strategy code, you need to understand how crypto orderbooks actually work — maker/taker dynamics, fee structures, and why the bid-ask spread is your first cost of doing business.

Market StructureOrderbookFundamentals
7 minFeb 3, 2026
Read
T2python

Vectorized Backtesting with Pandas: 100x Faster Than Loops

Row-by-row loops in backtesting are an anti-pattern that will have you waiting 30 minutes for a 1-year backtest. Vectorized operations across DataFrames give you the same results in under 20 seconds.

PandasPythonPerformance
11 minJan 29, 2026
Read