← all entries
A-TIER technique

VectorBT Grid Search — mmap data, joblib batching and vectorized backtests

quant.dhawan · 2026-01-02T13:08:50.000Z · in Quant & Trading
Open post ↗

100k ft — What is this?

VectorBT Grid Search — mmap data, joblib batching and vectorized backtests
techniqueA-tier

50k ft — Why care?

A speed recipe for strategy grid searches with VectorBT: load OHLCV via numpy memmap (mmap_mode='r', copy=False) to avoid RAM blowups, fan thousands of backtests across cores with joblib Parallel, batch tasks in groups of 1,000, and run Portfolio.from_signals with fees and slippage as Numba-compiled matrix ops. Illustrated with a BTC moving-average crossover return surface.
backtestingdata sciencefinance/tradingpythonquant

10k ft — Key takeaways

• Always pass fees and slippage into Portfolio.from_signals so grid winners are not fee artifacts. • Batch joblib tasks to keep all cores saturated and cut process overhead. • More accessible entry point for retail → quant transition • Use np.load(..., mmap_mode='r') and DataFrame(copy=False) to backtest many tickers without RAM spikes. • VectorBT enables fast vectorized strategy backtesting

5k ft — Tools & techniques

NumPy, Numba, Python, VectorBT, joblib, pandas Vectorized Backtesting, algorithmic trading, backtesting, memory mapping, parallel batching, parameter grid search, vectorized backtesting

1k ft — Deep-dive / try it

VectorBT explained for Retail Bros #finance #quantfinance #trading #quantrading rishabh_singh05   26w How to join ur classes?

More from @quant.dhawan

Collection: Quant & Trading