Inefficient Loop in backtesting for large datasets
Author: VinayakTiwari1103Created May 13, 2025Updated May 13, 2025
Aligning rebalance dates uses a list comprehension with per-iteration filtering, which is inefficient for large datasets. i am creating PR which calculates rebal_dates by scanning a date index for each target date an O(n×m) operation that can be vectorized.
Source: goldmansachs/gs-quant