GPU-accelerated quantitative backtesting and large-scale parameter sweep engine written in Python and OpenCL C99 (fp64).
Running multi-parameter grid searches across multi-year intraday time series in pure Python or single-threaded CPU loops becomes a bottleneck when state transitions depend on path-dependent indicator logic. This repository implements the core state machine and equity simulation directly in OpenCL C99 (strategy.cl) using double-precision floating point (cl_khr_fp64), driven from Python via pyopencl.
strategy.cl— OpenCL C99 kernel executing parallel parameter combinations across GPU work-items withfp64precision.strategy_opencl.py— Host-sidePyOpenCLbuffer allocation, kernel compilation, work-group dispatch, and result aggregation.strategy_numba.py/strategy.py— CPU reference implementations used for verification and fallback execution.test_parity.py— Verification suite checking 1:1 numerical parity between the OpenCL GPU kernel and the Python/NumPy reference implementation.leveraged_equity.py— Path-dependent leveraged equity, drawdown, and liquidation simulator.grid_search.py— Batch orchestrator for multi-dimensional parameter sweeps.
- Python 3.10+
pyopencl,numpy,pandas,numba- OpenCL 1.2+ compatible GPU or CPU runtime with
fp64support